linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] intel: Mark expected switch fall-throughs
@ 2019-01-23  7:48 Gustavo A. R. Silva
  2019-01-23 17:04 ` Jeff Kirsher
  0 siblings, 1 reply; 4+ messages in thread
From: Gustavo A. R. Silva @ 2019-01-23  7:48 UTC (permalink / raw)
  To: Jeff Kirsher, David S. Miller
  Cc: intel-wired-lan, netdev, linux-kernel, Gustavo A. R. Silva

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

This patch fixes the following warnings:

drivers/net/ethernet/intel/igb/e1000_82575.c:636:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/net/ethernet/intel/igb/igb_main.c:6710:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/net/ethernet/intel/i40e/i40e_xsk.c:237:3: warning: this statement may fall through [-Wimplicit-fallthrough=]

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enabling
-Wimplicit-fallthrough.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/net/ethernet/intel/i40e/i40e_xsk.c   | 3 ++-
 drivers/net/ethernet/intel/igb/e1000_82575.c | 2 +-
 drivers/net/ethernet/intel/igb/igb_main.c    | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
index 96d849460d9b..774e31405ba0 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
@@ -235,9 +235,10 @@ static int i40e_run_xdp_zc(struct i40e_ring *rx_ring, struct xdp_buff *xdp)
 		break;
 	default:
 		bpf_warn_invalid_xdp_action(act);
+		/* fall through */
 	case XDP_ABORTED:
 		trace_xdp_exception(rx_ring->netdev, xdp_prog, act);
-		/* fallthrough -- handle aborts by dropping packet */
+		/* fall through - handle aborts by dropping packet */
 	case XDP_DROP:
 		result = I40E_XDP_CONSUMED;
 		break;
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c
index bafdcf70a353..3ec2ce0725d5 100644
--- a/drivers/net/ethernet/intel/igb/e1000_82575.c
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.c
@@ -638,7 +638,7 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)
 			dev_spec->sgmii_active = true;
 			break;
 		}
-		/* fall through for I2C based SGMII */
+		/* fall through - for I2C based SGMII */
 	case E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES:
 		/* read media type from SFP EEPROM */
 		ret_val = igb_set_sfp_media_type_82575(hw);
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index dfa357b1a9d6..2c88e47574a7 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -6713,7 +6713,7 @@ static int __igb_notify_dca(struct device *dev, void *data)
 			igb_setup_dca(adapter);
 			break;
 		}
-		/* Fall Through since DCA is disabled. */
+		/* Fall Through - since DCA is disabled. */
 	case DCA_PROVIDER_REMOVE:
 		if (adapter->flags & IGB_FLAG_DCA_ENABLED) {
 			/* without this a class_device is left
-- 
2.20.1


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

* Re: [PATCH net-next] intel: Mark expected switch fall-throughs
  2019-01-23  7:48 [PATCH net-next] intel: Mark expected switch fall-throughs Gustavo A. R. Silva
@ 2019-01-23 17:04 ` Jeff Kirsher
  2019-01-23 17:11   ` Gustavo A. R. Silva
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Kirsher @ 2019-01-23 17:04 UTC (permalink / raw)
  To: Gustavo A. R. Silva, David S. Miller
  Cc: intel-wired-lan, netdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1283 bytes --]

On Wed, 2019-01-23 at 01:48 -0600, Gustavo A. R. Silva wrote:
> In preparation to enabling -Wimplicit-fallthrough, mark switch cases
> where we are expecting to fall through.
> 
> This patch fixes the following warnings:
> 
> drivers/net/ethernet/intel/igb/e1000_82575.c:636:6: warning: this
> statement may fall through [-Wimplicit-fallthrough=]
> drivers/net/ethernet/intel/igb/igb_main.c:6710:6: warning: this
> statement may fall through [-Wimplicit-fallthrough=]
> drivers/net/ethernet/intel/i40e/i40e_xsk.c:237:3: warning: this
> statement may fall through [-Wimplicit-fallthrough=]
> 
> Warning level 3 was used: -Wimplicit-fallthrough=3
> 
> This patch is part of the ongoing efforts to enabling
> -Wimplicit-fallthrough.
> 
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_xsk.c   | 3 ++-
>  drivers/net/ethernet/intel/igb/e1000_82575.c | 2 +-
>  drivers/net/ethernet/intel/igb/igb_main.c    | 2 +-
>  3 files changed, 4 insertions(+), 3 deletions(-)

NAK on the igb changes.  There is already a "fall through" code comment
which is fine, adding a hyphen does not make the comment any more
readable.

The i40e changes are acceptable, if you want to re-submit with only
those changes.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH net-next] intel: Mark expected switch fall-throughs
  2019-01-23 17:04 ` Jeff Kirsher
@ 2019-01-23 17:11   ` Gustavo A. R. Silva
  2019-01-23 17:44     ` Jeff Kirsher
  0 siblings, 1 reply; 4+ messages in thread
From: Gustavo A. R. Silva @ 2019-01-23 17:11 UTC (permalink / raw)
  To: jeffrey.t.kirsher, David S. Miller; +Cc: intel-wired-lan, netdev, linux-kernel

Hi Jeffrey,

On 1/23/19 11:04 AM, Jeff Kirsher wrote:
> On Wed, 2019-01-23 at 01:48 -0600, Gustavo A. R. Silva wrote:
>> In preparation to enabling -Wimplicit-fallthrough, mark switch cases
>> where we are expecting to fall through.
>>
>> This patch fixes the following warnings:
>>
>> drivers/net/ethernet/intel/igb/e1000_82575.c:636:6: warning: this
>> statement may fall through [-Wimplicit-fallthrough=]
>> drivers/net/ethernet/intel/igb/igb_main.c:6710:6: warning: this
>> statement may fall through [-Wimplicit-fallthrough=]
>> drivers/net/ethernet/intel/i40e/i40e_xsk.c:237:3: warning: this
>> statement may fall through [-Wimplicit-fallthrough=]
>>
>> Warning level 3 was used: -Wimplicit-fallthrough=3
>>
>> This patch is part of the ongoing efforts to enabling
>> -Wimplicit-fallthrough.
>>
>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
>> ---
>>  drivers/net/ethernet/intel/i40e/i40e_xsk.c   | 3 ++-
>>  drivers/net/ethernet/intel/igb/e1000_82575.c | 2 +-
>>  drivers/net/ethernet/intel/igb/igb_main.c    | 2 +-
>>  3 files changed, 4 insertions(+), 3 deletions(-)
> 
> NAK on the igb changes.  There is already a "fall through" code comment
> which is fine, adding a hyphen does not make the comment any more
> readable.
> 

Those comments are not fine. They trigger the warnings I mention in the
commit log. With this patch such warnings are fixed.

Notice that warning level 3 was used: -Wimplicit-fallthrough=3

Thanks
--
Gustavo

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

* Re: [PATCH net-next] intel: Mark expected switch fall-throughs
  2019-01-23 17:11   ` Gustavo A. R. Silva
@ 2019-01-23 17:44     ` Jeff Kirsher
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Kirsher @ 2019-01-23 17:44 UTC (permalink / raw)
  To: Gustavo A. R. Silva, David S. Miller
  Cc: intel-wired-lan, netdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2121 bytes --]

On Wed, 2019-01-23 at 11:11 -0600, Gustavo A. R. Silva wrote:
> Hi Jeffrey,
> 
> On 1/23/19 11:04 AM, Jeff Kirsher wrote:
> > On Wed, 2019-01-23 at 01:48 -0600, Gustavo A. R. Silva wrote:
> > > In preparation to enabling -Wimplicit-fallthrough, mark switch
> > > cases
> > > where we are expecting to fall through.
> > > 
> > > This patch fixes the following warnings:
> > > 
> > > drivers/net/ethernet/intel/igb/e1000_82575.c:636:6: warning: this
> > > statement may fall through [-Wimplicit-fallthrough=]
> > > drivers/net/ethernet/intel/igb/igb_main.c:6710:6: warning: this
> > > statement may fall through [-Wimplicit-fallthrough=]
> > > drivers/net/ethernet/intel/i40e/i40e_xsk.c:237:3: warning: this
> > > statement may fall through [-Wimplicit-fallthrough=]
> > > 
> > > Warning level 3 was used: -Wimplicit-fallthrough=3
> > > 
> > > This patch is part of the ongoing efforts to enabling
> > > -Wimplicit-fallthrough.
> > > 
> > > Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> > > ---
> > >   drivers/net/ethernet/intel/i40e/i40e_xsk.c   | 3 ++-
> > >   drivers/net/ethernet/intel/igb/e1000_82575.c | 2 +-
> > >   drivers/net/ethernet/intel/igb/igb_main.c    | 2 +-
> > >   3 files changed, 4 insertions(+), 3 deletions(-)
> > 
> > NAK on the igb changes.  There is already a "fall through" code
> > comment
> > which is fine, adding a hyphen does not make the comment any more
> > readable.
> > 
> 
> Those comments are not fine. They trigger the warnings I mention in
> the
> commit log. With this patch such warnings are fixed.
> 
> Notice that warning level 3 was used: -Wimplicit-fallthrough=3

This is a "false positive" based on the compiler option definition:

-Wimplicit-fallthrough=3 case sensitively matches a wide range of
regular expressions, listed in the GCC manual. E.g., all of these are
accepted:
/* Falls through. */
/* fall-thru */
/* Else falls through. */
/* FALLTHRU */
/* … falls through … */
etc.

You should be looking to fix the problem with the compiler option,
which is reporting "acceptable" code comments.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2019-01-23 17:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-23  7:48 [PATCH net-next] intel: Mark expected switch fall-throughs Gustavo A. R. Silva
2019-01-23 17:04 ` Jeff Kirsher
2019-01-23 17:11   ` Gustavo A. R. Silva
2019-01-23 17:44     ` Jeff Kirsher

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).