linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Mark expected switch fall-throughs and fix missing break
@ 2018-10-22 11:49 Gustavo A. R. Silva
  2018-10-22 11:50 ` [PATCH 1/2] rtl8xxxu: Mark expected switch fall-throughs Gustavo A. R. Silva
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Gustavo A. R. Silva @ 2018-10-22 11:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jes Sorensen, Kalle Valo, linux-wireless, David S. Miller,
	netdev, Gustavo A. R. Silva

In preparation to enabling -Wimplicit-fallthrough, this patchset aims
to mark multiple switch cases where we are expecting to fall through.

Also, the second patch in this series fixes a missing break in switch.

Thanks

Gustavo A. R. Silva (2):
  rtl8xxxu: Mark expected switch fall-throughs
  rtl8xxxu: Fix missing break in switch

 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 5 +++++
 1 file changed, 5 insertions(+)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] rtl8xxxu: Mark expected switch fall-throughs
  2018-10-22 11:49 [PATCH 0/2] Mark expected switch fall-throughs and fix missing break Gustavo A. R. Silva
@ 2018-10-22 11:50 ` Gustavo A. R. Silva
  2018-11-06 16:59   ` Kalle Valo
  2018-10-22 11:51 ` [PATCH 2/2] rtl8xxxu: Fix missing break in switch Gustavo A. R. Silva
  2018-10-22 14:36 ` [PATCH 0/2] Mark expected switch fall-throughs and fix missing break Jes Sorensen
  2 siblings, 1 reply; 6+ messages in thread
From: Gustavo A. R. Silva @ 2018-10-22 11:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jes Sorensen, Kalle Valo, linux-wireless, David S. Miller,
	netdev, Gustavo A. R. Silva

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1357355 ("Missing break in switch")
Addresses-Coverity-ID: 1357378 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index 56040b1..c6b0686 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -1153,6 +1153,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 */
 	case NL80211_CHAN_WIDTH_20:
 		opmode |= BW_OPMODE_20MHZ;
 		rtl8xxxu_write8(priv, REG_BW_OPMODE, opmode);
@@ -1280,6 +1281,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 */
 	case NL80211_CHAN_WIDTH_20:
 		rf_mode_bw |= WMAC_TRXPTCL_CTL_BW_20;
 		subchannel = 0;
@@ -1748,9 +1750,11 @@ static int rtl8xxxu_identify_chip(struct rtl8xxxu_priv *priv)
 		case 3:
 			priv->ep_tx_low_queue = 1;
 			priv->ep_tx_count++;
+			/* fall through */
 		case 2:
 			priv->ep_tx_normal_queue = 1;
 			priv->ep_tx_count++;
+			/* fall through */
 		case 1:
 			priv->ep_tx_high_queue = 1;
 			priv->ep_tx_count++;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] rtl8xxxu: Fix missing break in switch
  2018-10-22 11:49 [PATCH 0/2] Mark expected switch fall-throughs and fix missing break Gustavo A. R. Silva
  2018-10-22 11:50 ` [PATCH 1/2] rtl8xxxu: Mark expected switch fall-throughs Gustavo A. R. Silva
@ 2018-10-22 11:51 ` Gustavo A. R. Silva
  2018-10-22 14:36 ` [PATCH 0/2] Mark expected switch fall-throughs and fix missing break Jes Sorensen
  2 siblings, 0 replies; 6+ messages in thread
From: Gustavo A. R. Silva @ 2018-10-22 11:51 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jes Sorensen, Kalle Valo, linux-wireless, David S. Miller,
	netdev, Gustavo A. R. Silva

Add missing break statement in order to prevent the code from falling
through to the default case.

Fixes: 26f1fad29ad9 ("New driver: rtl8xxxu (mac80211)")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index c6b0686..2bd4305 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -5692,6 +5692,7 @@ static int rtl8xxxu_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 		break;
 	case WLAN_CIPHER_SUITE_TKIP:
 		key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
+		break;
 	default:
 		return -EOPNOTSUPP;
 	}
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] Mark expected switch fall-throughs and fix missing break
  2018-10-22 11:49 [PATCH 0/2] Mark expected switch fall-throughs and fix missing break Gustavo A. R. Silva
  2018-10-22 11:50 ` [PATCH 1/2] rtl8xxxu: Mark expected switch fall-throughs Gustavo A. R. Silva
  2018-10-22 11:51 ` [PATCH 2/2] rtl8xxxu: Fix missing break in switch Gustavo A. R. Silva
@ 2018-10-22 14:36 ` Jes Sorensen
  2018-10-22 14:53   ` Gustavo A. R. Silva
  2 siblings, 1 reply; 6+ messages in thread
From: Jes Sorensen @ 2018-10-22 14:36 UTC (permalink / raw)
  To: Gustavo A. R. Silva, linux-kernel
  Cc: Kalle Valo, linux-wireless, David S. Miller, netdev

On 10/22/18 7:49 AM, Gustavo A. R. Silva wrote:
> In preparation to enabling -Wimplicit-fallthrough, this patchset aims
> to mark multiple switch cases where we are expecting to fall through.
> 
> Also, the second patch in this series fixes a missing break in switch.

Enabling that sounds like a great way to inflict pain and suffering.

Not a big deal to put that in the code, the second patch looks fine though.

Jes

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] Mark expected switch fall-throughs and fix missing break
  2018-10-22 14:36 ` [PATCH 0/2] Mark expected switch fall-throughs and fix missing break Jes Sorensen
@ 2018-10-22 14:53   ` Gustavo A. R. Silva
  0 siblings, 0 replies; 6+ messages in thread
From: Gustavo A. R. Silva @ 2018-10-22 14:53 UTC (permalink / raw)
  To: Jes Sorensen, linux-kernel
  Cc: Kalle Valo, linux-wireless, David S. Miller, netdev


On 10/22/18 4:36 PM, Jes Sorensen wrote:
> On 10/22/18 7:49 AM, Gustavo A. R. Silva wrote:
>> In preparation to enabling -Wimplicit-fallthrough, this patchset aims
>> to mark multiple switch cases where we are expecting to fall through.
>>
>> Also, the second patch in this series fixes a missing break in switch.
> 
> Enabling that sounds like a great way to inflict pain and suffering.
> 

Not really. The -Wimplicit-fallthrough will be enabled until after all the
current warnings have been addressed.

There are 600 of these issues left. So, hopefully I will complete this task
during the next development cycle.

Thanks
--
Gustavo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] rtl8xxxu: Mark expected switch fall-throughs
  2018-10-22 11:50 ` [PATCH 1/2] rtl8xxxu: Mark expected switch fall-throughs Gustavo A. R. Silva
@ 2018-11-06 16:59   ` Kalle Valo
  0 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2018-11-06 16:59 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: linux-kernel, Jes Sorensen, linux-wireless, David S. Miller,
	netdev, Gustavo A. R. Silva

"Gustavo A. R. Silva" <gustavo@embeddedor.com> wrote:

> In preparation to enabling -Wimplicit-fallthrough, mark switch cases
> where we are expecting to fall through.
> 
> Addresses-Coverity-ID: 1357355 ("Missing break in switch")
> Addresses-Coverity-ID: 1357378 ("Missing break in switch")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

2 patches applied to wireless-drivers-next.git, thanks.

e20c50cdca19 rtl8xxxu: Mark expected switch fall-throughs
307b00c5e695 rtl8xxxu: Fix missing break in switch

-- 
https://patchwork.kernel.org/patch/10651953/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-11-06 16:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-22 11:49 [PATCH 0/2] Mark expected switch fall-throughs and fix missing break Gustavo A. R. Silva
2018-10-22 11:50 ` [PATCH 1/2] rtl8xxxu: Mark expected switch fall-throughs Gustavo A. R. Silva
2018-11-06 16:59   ` Kalle Valo
2018-10-22 11:51 ` [PATCH 2/2] rtl8xxxu: Fix missing break in switch Gustavo A. R. Silva
2018-10-22 14:36 ` [PATCH 0/2] Mark expected switch fall-throughs and fix missing break Jes Sorensen
2018-10-22 14:53   ` Gustavo A. R. Silva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).