diff mbox series

[117/141] rtl8xxxu: Fix fall-through warnings for Clang

Message ID d522f387b2d0dde774785c7169c1f25aa529989d.1605896060.git.gustavoars@kernel.org
State Superseded
Headers show
Series Fix fall-through warnings for Clang | expand

Commit Message

Gustavo A. R. Silva Nov. 20, 2020, 6:38 p.m. UTC
In preparation to enable -Wimplicit-fallthrough for Clang, fix
multiple warnings by replacing /* fall through */ comments with
the new pseudo-keyword macro fallthrough; instead of letting the
code fall through to the next case.

Notice that Clang doesn't recognize /* fall through */ comments as
implicit fall-through markings.

Link: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Jes Sorensen Nov. 20, 2020, 9:39 p.m. UTC | #1
On 11/20/20 1:38 PM, Gustavo A. R. Silva wrote:
> In preparation to enable -Wimplicit-fallthrough for Clang, fix
> multiple warnings by replacing /* fall through */ comments with
> the new pseudo-keyword macro fallthrough; instead of letting the
> code fall through to the next case.
> 
> Notice that Clang doesn't recognize /* fall through */ comments as
> implicit fall-through markings.
> 
> Link: https://github.com/KSPP/linux/issues/115
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> ---
>  drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

While I wasn't CC'ed on the cover-letter I see Jakub also raised issues
about this unnecessary patch noise.

Quite frankly, this seems to be patch churn for the sake of patch churn.
If clang is broken, fix clang instead.

NACK


Jes

> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> index 5cd7ef3625c5..afc97958fa4d 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> @@ -1145,7 +1145,7 @@ void rtl8xxxu_gen1_config_channel(struct ieee80211_hw *hw)
>  	switch (hw->conf.chandef.width) {
>  	case NL80211_CHAN_WIDTH_20_NOHT:
>  		ht = false;
> -		/* fall through */
> +		fallthrough;
>  	case NL80211_CHAN_WIDTH_20:
>  		opmode |= BW_OPMODE_20MHZ;
>  		rtl8xxxu_write8(priv, REG_BW_OPMODE, opmode);
> @@ -1272,7 +1272,7 @@ void rtl8xxxu_gen2_config_channel(struct ieee80211_hw *hw)
>  	switch (hw->conf.chandef.width) {
>  	case NL80211_CHAN_WIDTH_20_NOHT:
>  		ht = false;
> -		/* fall through */
> +		fallthrough;
>  	case NL80211_CHAN_WIDTH_20:
>  		rf_mode_bw |= WMAC_TRXPTCL_CTL_BW_20;
>  		subchannel = 0;
> @@ -1741,11 +1741,11 @@ static int rtl8xxxu_identify_chip(struct rtl8xxxu_priv *priv)
>  		case 3:
>  			priv->ep_tx_low_queue = 1;
>  			priv->ep_tx_count++;
> -			/* fall through */
> +			fallthrough;
>  		case 2:
>  			priv->ep_tx_normal_queue = 1;
>  			priv->ep_tx_count++;
> -			/* fall through */
> +			fallthrough;
>  		case 1:
>  			priv->ep_tx_high_queue = 1;
>  			priv->ep_tx_count++;
>
Gustavo A. R. Silva Nov. 24, 2020, 4:09 p.m. UTC | #2
On Fri, Nov 20, 2020 at 04:39:42PM -0500, Jes Sorensen wrote:
> On 11/20/20 1:38 PM, Gustavo A. R. Silva wrote:
> > In preparation to enable -Wimplicit-fallthrough for Clang, fix
> > multiple warnings by replacing /* fall through */ comments with
> > the new pseudo-keyword macro fallthrough; instead of letting the
> > code fall through to the next case.
> > 
> > Notice that Clang doesn't recognize /* fall through */ comments as
> > implicit fall-through markings.
> > 
> > Link: https://github.com/KSPP/linux/issues/115
> > Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> > ---
> >  drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> While I wasn't CC'ed on the cover-letter I see Jakub also raised issues
> about this unnecessary patch noise.
> 
> Quite frankly, this seems to be patch churn for the sake of patch churn.
> If clang is broken, fix clang instead.

Just notice that the idea behind this and the following patch is exactly
the same:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git/commit/?id=3f95e92c8a8516b745594049dfccc8c5f8895eea

I could resend this same patch with a different changelog text, but I
don't think such a thing is necessary. However, if people prefer that
approach, just let me know and I can do it.

Thanks
--
Gustavo

> > diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> > index 5cd7ef3625c5..afc97958fa4d 100644
> > --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> > +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> > @@ -1145,7 +1145,7 @@ void rtl8xxxu_gen1_config_channel(struct ieee80211_hw *hw)
> >  	switch (hw->conf.chandef.width) {
> >  	case NL80211_CHAN_WIDTH_20_NOHT:
> >  		ht = false;
> > -		/* fall through */
> > +		fallthrough;
> >  	case NL80211_CHAN_WIDTH_20:
> >  		opmode |= BW_OPMODE_20MHZ;
> >  		rtl8xxxu_write8(priv, REG_BW_OPMODE, opmode);
> > @@ -1272,7 +1272,7 @@ void rtl8xxxu_gen2_config_channel(struct ieee80211_hw *hw)
> >  	switch (hw->conf.chandef.width) {
> >  	case NL80211_CHAN_WIDTH_20_NOHT:
> >  		ht = false;
> > -		/* fall through */
> > +		fallthrough;
> >  	case NL80211_CHAN_WIDTH_20:
> >  		rf_mode_bw |= WMAC_TRXPTCL_CTL_BW_20;
> >  		subchannel = 0;
> > @@ -1741,11 +1741,11 @@ static int rtl8xxxu_identify_chip(struct rtl8xxxu_priv *priv)
> >  		case 3:
> >  			priv->ep_tx_low_queue = 1;
> >  			priv->ep_tx_count++;
> > -			/* fall through */
> > +			fallthrough;
> >  		case 2:
> >  			priv->ep_tx_normal_queue = 1;
> >  			priv->ep_tx_count++;
> > -			/* fall through */
> > +			fallthrough;
> >  		case 1:
> >  			priv->ep_tx_high_queue = 1;
> >  			priv->ep_tx_count++;
> > 
>
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index 5cd7ef3625c5..afc97958fa4d 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -1145,7 +1145,7 @@  void rtl8xxxu_gen1_config_channel(struct ieee80211_hw *hw)
 	switch (hw->conf.chandef.width) {
 	case NL80211_CHAN_WIDTH_20_NOHT:
 		ht = false;
-		/* fall through */
+		fallthrough;
 	case NL80211_CHAN_WIDTH_20:
 		opmode |= BW_OPMODE_20MHZ;
 		rtl8xxxu_write8(priv, REG_BW_OPMODE, opmode);
@@ -1272,7 +1272,7 @@  void rtl8xxxu_gen2_config_channel(struct ieee80211_hw *hw)
 	switch (hw->conf.chandef.width) {
 	case NL80211_CHAN_WIDTH_20_NOHT:
 		ht = false;
-		/* fall through */
+		fallthrough;
 	case NL80211_CHAN_WIDTH_20:
 		rf_mode_bw |= WMAC_TRXPTCL_CTL_BW_20;
 		subchannel = 0;
@@ -1741,11 +1741,11 @@  static int rtl8xxxu_identify_chip(struct rtl8xxxu_priv *priv)
 		case 3:
 			priv->ep_tx_low_queue = 1;
 			priv->ep_tx_count++;
-			/* fall through */
+			fallthrough;
 		case 2:
 			priv->ep_tx_normal_queue = 1;
 			priv->ep_tx_count++;
-			/* fall through */
+			fallthrough;
 		case 1:
 			priv->ep_tx_high_queue = 1;
 			priv->ep_tx_count++;