From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752423AbcHKWui convert rfc822-to-8bit (ORCPT ); Thu, 11 Aug 2016 18:50:38 -0400 Received: from [220.194.60.87] ([220.194.60.87]:57164 "EHLO mail.redflag-linux.com" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752015AbcHKWug (ORCPT ); Thu, 11 Aug 2016 18:50:36 -0400 X-DSPAM-Processed: Fri Aug 12 06:39:59 2016 X-DSPAM-Confidence: 0.9952 X-DSPAM-Probability: 0.0000 X-Spam-Flag: NO X-Spam-Score: -2 X-DSPAM-Result: Whitelisted X-DSPAM-Signature: 1,57acfebf17301337191261 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: [PATCH] Staging: rtl8723au: os_intfs: fixed case statement is variable issue From: sunbing In-Reply-To: Date: Fri, 12 Aug 2016 06:50:03 +0800 Cc: Larry.Finger@lwfinger.net, gregkh@linuxfoundation.org, linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, sunbing.linux@gmail.com Content-Transfer-Encoding: 8BIT Message-Id: <7FC388BC-FD87-44C6-87D3-AC041F1393DB@redflag-linux.com> References: <1470924695-14931-1-git-send-email-sunbing@redflag-linux.com> To: Jes Sorensen X-Mailer: Apple Mail (2.1878.6) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Aug 11, 2016, at 23:25, Jes Sorensen wrote: > Bing Sun writes: >> Fixed sparse parse error: >> Expected constant expression in case statement. >> >> Signed-off-by: Bing Sun >> --- >> drivers/staging/rtl8723au/os_dep/os_intfs.c | 11 +++++------ >> 1 file changed, 5 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/staging/rtl8723au/os_dep/os_intfs.c b/drivers/staging/rtl8723au/os_dep/os_intfs.c >> index b8848c2..f30d5d2 100644 >> --- a/drivers/staging/rtl8723au/os_dep/os_intfs.c >> +++ b/drivers/staging/rtl8723au/os_dep/os_intfs.c >> @@ -283,14 +283,13 @@ static u32 rtw_classify8021d(struct sk_buff *skb) >> */ >> if (skb->priority >= 256 && skb->priority <= 263) >> return skb->priority - 256; >> - switch (skb->protocol) { >> - case htons(ETH_P_IP): >> + >> + if (skb->protocol == htons(ETH_P_IP)) { >> dscp = ip_hdr(skb)->tos & 0xfc; >> - break; >> - default: >> - return 0; >> + return dscp >> 5; >> } >> - return dscp >> 5; >> + >> + return 0; >> } > > Pardon me here, but I find it really hard to see how this change is an > improvement over the old code in any shape or form. > > Jes There is no functional improvement. But before this patch, when we do: make C=1 M=drivers/staging/rtl8723au/ An error output: drivers/staging/rtl8723au//os_dep/os_intfs.c:287:14: error: Expected constant expression in case statement To avoid sparse parse error, a case statement converts to an if statement. So we got this patch.