Skip to contentSkip to conversation

Wimplicit-fallthrough patches for 5.3-rc1

GIT PULL Gustavo A. R. Silva 2 participants 6 messages Jul 9, 2019 – Jul 21, 2019

lore
Share & tools
lore
#0 lore raw

The following changes since commit cd6c84d8f0cdc911df435bb075ba22ce3c605b07:

Linux 5.2-rc2 (2019-05-26 16:49:19 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git tags/Wimplicit-fallthrough-5.3-rc1

for you to fetch changes up to d93512ef0f0efa17eded6b9edf8e88e8418f44bd:

Makefile: Globally enable fall-through warning (2019-07-08 15:23:22 -0500)

----------------------------------------------------------------
Wimplicit-fallthrough patches for 5.3-rc1

Hi Linus,

Please, pull the following patches that mark switch cases where we are expecting to fall through. These patches are part of the ongoing efforts to enable -Wimplicit-fallthrough. All of them have been baking in linux-next for a whole development cycle.

Also, pull the Makefile patch that universally enables the -Wimplicit-fallthrough option.

Thanks

----------------------------------------------------------------
Gustavo A. R. Silva (6):
afs: fsclient: Mark expected switch fall-throughs
afs: yfsclient: Mark expected switch fall-throughs
can: mark expected switch fall-throughs
firewire: mark expected switch fall-throughs platform/x86: acer-wmi: Mark expected switch fall-throughs
Makefile: Globally enable fall-through warning

 Documentation/process/deprecated.rst          | 14 +++++++
 Makefile                                      |  3 ++
 drivers/firewire/core-device.c                |  2 +-
 drivers/firewire/core-iso.c                   |  2 +-
 drivers/firewire/core-topology.c              |  1 +
 drivers/net/can/at91_can.c                    |  6 ++-
 drivers/net/can/peak_canfd/peak_pciefd_main.c |  2 +-
 drivers/net/can/spi/mcp251x.c                 |  3 +-
 drivers/net/can/usb/peak_usb/pcan_usb.c       |  2 +-
 drivers/platform/x86/acer-wmi.c               |  4 ++
 fs/afs/fsclient.c                             | 51 ++++++++++++++++---------
 fs/afs/yfsclient.c                            | 54 +++++++++++++++++----------
 12 files changed, 100 insertions(+), 44 deletions(-)
#1 lore raw

Hi Gustavo,

Quoted 2 lines · On Tue, 9 Jul 2019 13:20:10 -0500 "Gustavo A. R. Silva"…

Makefile: Globally enable fall-through warning (2019-07-08 15:23:22 -0500)

There are still a few of these warnings in various builds. My x86_64 allmodconfig build after merging your tree into Linus' tree this morning looked like below (which is way better than when you started). I reported (most of) these along the way ...

arch/x86/events/intel/core.c: In function 'intel_pmu_init':
arch/x86/events/intel/core.c:4959:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
pmem = true;
~~~~~^~~~~~
arch/x86/events/intel/core.c:4960:2: note: here
case INTEL_FAM6_SKYLAKE_MOBILE:
^~~~
arch/x86/events/intel/core.c:5008:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
pmem = true;
~~~~~^~~~~~
arch/x86/events/intel/core.c:5009:2: note: here
case INTEL_FAM6_ICELAKE_MOBILE:
^~~~
fs/btrfs/props.c: In function 'inherit_props':
fs/btrfs/props.c:389:4: warning: 'num_bytes' may be used uninitialized in this function [-Wmaybe-uninitialized]

    btrfs_block_rsv_release(fs_info, trans->block_rsv,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      num_bytes);
      ~~~~~~~~~~
drivers/mtd/nand/onenand/onenand_base.c: In function 'onenand_check_features':
drivers/mtd/nand/onenand/onenand_base.c:3261:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
   if (ONENAND_IS_DDP(this))
      ^

drivers/mtd/nand/onenand/onenand_base.c:3281:2: note: here
case ONENAND_DEVICE_DENSITY_2Gb:
^~~~
drivers/mtd/nand/onenand/onenand_base.c:3285:17: warning: this statement may fall through [-Wimplicit-fallthrough=]
this->options |= ONENAND_HAS_UNLOCK_ALL;
drivers/mtd/nand/onenand/onenand_base.c:3287:2: note: here
case ONENAND_DEVICE_DENSITY_1Gb:
^~~~
drivers/net/ethernet/intel/igb/e1000_82575.c: In function 'igb_get_invariants_82575':
drivers/net/ethernet/intel/igb/e1000_82575.c:636:6: warning: this statement may fall through [-Wimplicit-fallthrough=]

   if (igb_sgmii_uses_mdio_82575(hw)) {
      ^

drivers/net/ethernet/intel/igb/e1000_82575.c:642:2: note: here
case E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES:
^~~~
drivers/net/ethernet/intel/igb/igb_main.c: In function '__igb_notify_dca':
drivers/net/ethernet/intel/igb/igb_main.c:6692:6: warning: this statement may fall through [-Wimplicit-fallthrough=]

   if (dca_add_requester(dev) == 0) {
      ^

drivers/net/ethernet/intel/igb/igb_main.c:6699:2: note: here
case DCA_PROVIDER_REMOVE:
^~~~
drivers/net/ethernet/intel/i40e/i40e_xsk.c: In function 'i40e_run_xdp_zc':
drivers/net/ethernet/intel/i40e/i40e_xsk.c:217:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
bpf_warn_invalid_xdp_action(act);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/intel/i40e/i40e_xsk.c:218:2: note: here
case XDP_ABORTED:
^~~~

Signature · 2 lines
Cheers,
Stephen Rothwell
#2 lore raw

Hi Stephen,

Quoted 19 lines · Stephen Rothwell

Hi Gustavo,

Quoted 2 lines · On Tue, 9 Jul 2019 13:20:10 -0500 "Gustavo A. R. Silva"…

Makefile: Globally enable fall-through warning (2019-07-08 15:23:22 -0500)

There are still a few of these warnings in various builds. My x86_64 allmodconfig build after merging your tree into Linus' tree this morning looked like below (which is way better than when you started). I reported (most of) these along the way ...

arch/x86/events/intel/core.c: In function 'intel_pmu_init':
arch/x86/events/intel/core.c:4959:8: warning: this statement may fall through [-Wimplicit-fallthrough=]

   pmem = true;
   ~~~~~^~~~~~

arch/x86/events/intel/core.c:4960:2: note: here
case INTEL_FAM6_SKYLAKE_MOBILE:
^~~~
arch/x86/events/intel/core.c:5008:8: warning: this statement may fall through [-Wimplicit-fallthrough=]

Quoted 5 lines
   pmem = true;
   ~~~~~^~~~~~

arch/x86/events/intel/core.c:5009:2: note: here
case INTEL_FAM6_ICELAKE_MOBILE:
^~~~

I sent a patch for the warnings above, but it was ignored.

Quoted 10 lines

fs/btrfs/props.c: In function 'inherit_props':
fs/btrfs/props.c:389:4: warning: 'num_bytes' may be used uninitialized in this function [-Wmaybe-uninitialized]

    btrfs_block_rsv_release(fs_info, trans->block_rsv,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      num_bytes);
      ~~~~~~~~~~
drivers/mtd/nand/onenand/onenand_base.c: In function 'onenand_check_features':
drivers/mtd/nand/onenand/onenand_base.c:3261:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
   if (ONENAND_IS_DDP(this))
      ^
Quoted 8 lines

drivers/mtd/nand/onenand/onenand_base.c:3281:2: note: here
case ONENAND_DEVICE_DENSITY_2Gb:
^~~~
drivers/mtd/nand/onenand/onenand_base.c:3285:17: warning: this statement may fall through [-Wimplicit-fallthrough=]
this->options |= ONENAND_HAS_UNLOCK_ALL;
drivers/mtd/nand/onenand/onenand_base.c:3287:2: note: here
case ONENAND_DEVICE_DENSITY_1Gb:
^~~~

A patch for the above warnings is already queued up:

https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git/commit/?h=mtd/next&id=db01077c5fffc73fc190d6ce3d68ae083044e4a2

Quoted 9 lines

drivers/net/ethernet/intel/igb/e1000_82575.c: In function 'igb_get_invariants_82575':
drivers/net/ethernet/intel/igb/e1000_82575.c:636:6: warning: this statement may fall through [-Wimplicit-fallthrough=]

   if (igb_sgmii_uses_mdio_82575(hw)) {
      ^

drivers/net/ethernet/intel/igb/e1000_82575.c:642:2: note: here
case E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES:
^~~~
drivers/net/ethernet/intel/igb/igb_main.c: In function '__igb_notify_dca':
drivers/net/ethernet/intel/igb/igb_main.c:6692:6: warning: this statement may fall through [-Wimplicit-fallthrough=]

Quoted 5 lines
   if (dca_add_requester(dev) == 0) {
      ^

drivers/net/ethernet/intel/igb/igb_main.c:6699:2: note: here
case DCA_PROVIDER_REMOVE:
^~~~

Patches for the warnings above have been in Dave's queue for a while:

https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/?id=42277cedbaf40baef50fd4866b448eb791616b0a
https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/?id=b7b3ad7aaf4f5b7ef2561ae3462b2efbfbe23b12

Quoted 8 lines

drivers/net/ethernet/intel/i40e/i40e_xsk.c: In function 'i40e_run_xdp_zc':
drivers/net/ethernet/intel/i40e/i40e_xsk.c:217:3: warning: this statement may fall through [-Wimplicit-fallthrough=]

   bpf_warn_invalid_xdp_action(act);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

drivers/net/ethernet/intel/i40e/i40e_xsk.c:218:2: note: here
case XDP_ABORTED:
^~~~

This is already in Dave's queue:

https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/?id=514af5f0995219da7f18d73ecece6e7d1fec8c4e

At some point during this development cycle, we reached the quota of zero fall-through warnings, but people continued introducing such warnings. So, it seems we are now pretty much ready for enabling -Wimplicit-fallthrough globally. Before it turns into a never ending story. :)

Thanks
--
Gustavo

#3 lore raw

Hi Gustavo,

Quoted 5 lines · On Wed, 10 Jul 2019 13:14:10 -0500 "Gustavo A. R. Silva"…

At some point during this development cycle, we reached the quota of zero fall-through warnings, but people continued introducing such warnings. So, it seems we are now pretty much ready for enabling -Wimplicit-fallthrough globally. Before it turns into a never ending story. :)

Sounds good to me. My mail was, I guess, just a heads up to Linus that he will see some new warnings in his test build if he merges your tree. Thanks for addressing them.

Signature · 2 lines
Cheers,
Stephen Rothwell
#4 lore raw
Quoted 4 lines · Stephen Rothwell

Hi Gustavo,

Quoted 1 line · On Wed, 10 Jul 2019 13:14:10 -0500 "Gustavo A. R. Silva"…
Quoted 9 lines
Quoted 4 lines

At some point during this development cycle, we reached the quota of zero fall-through warnings, but people continued introducing such warnings. So, it seems we are now pretty much ready for enabling -Wimplicit-fallthrough globally. Before it turns into a never ending story. :)

Sounds good to me. My mail was, I guess, just a heads up to Linus that he will see some new warnings in his test build if he merges your tree. Thanks for addressing them.

Yep. Thanks, Stephen.

Linus:

After you have merged all the trees containing fall-through patches, you might see the following warnings:

arch/x86/events/intel/core.c:4957:8: warning: this statement may fall through [-Wimplicit-fallthrough=] arch/x86/events/intel/core.c:5006:8: warning: this statement may fall through [-Wimplicit-fallthrough=] drivers/mtd/nand/onenand/onenand_base.c:3261:6: warning: this statement may fall through [-Wimplicit-fallthrough=]

for which I already have patches ready to be applied, but I didn't include them in my pull-request because such patches don't apply to 5.2-rc2, on which I based my -next tree for v5.3.

We can coordinate and I can send you the patches that address those and any other warning that you might see after merging my pull-request and just before you release 5.3-rc1. So we can have the -Wimplicit-fallthrough option globally enabled in 5.3-rc1 and zero fall-through warnings.

What do you think?

Thanks
--
Gustavo

#5 lore raw

Hi Linus,

I noticed you didn't merge these changes in v5.3-rc1.

Should I send them again for rc2?

Do you have any comments on this pull-request?

Thanks
--
Gustavo

Quoted 42 lines · Gustavo A. R. Silva
Quoted 4 lines · Stephen Rothwell

Hi Gustavo,

Quoted 1 line · On Wed, 10 Jul 2019 13:14:10 -0500 "Gustavo A. R. Silva"…
Quoted 9 lines
Quoted 4 lines

At some point during this development cycle, we reached the quota of zero fall-through warnings, but people continued introducing such warnings. So, it seems we are now pretty much ready for enabling -Wimplicit-fallthrough globally. Before it turns into a never ending story. :)

Sounds good to me. My mail was, I guess, just a heads up to Linus that he will see some new warnings in his test build if he merges your tree. Thanks for addressing them.

Yep. Thanks, Stephen.

Linus:

After you have merged all the trees containing fall-through patches, you might see the following warnings:

arch/x86/events/intel/core.c:4957:8: warning: this statement may fall through [-Wimplicit-fallthrough=] arch/x86/events/intel/core.c:5006:8: warning: this statement may fall through [-Wimplicit-fallthrough=] drivers/mtd/nand/onenand/onenand_base.c:3261:6: warning: this statement may fall through [-Wimplicit-fallthrough=]

for which I already have patches ready to be applied, but I didn't include them in my pull-request because such patches don't apply to 5.2-rc2, on which I based my -next tree for v5.3.

We can coordinate and I can send you the patches that address those and any other warning that you might see after merging my pull-request and just before you release 5.3-rc1. So we can have the -Wimplicit-fallthrough option globally enabled in 5.3-rc1 and zero fall-through warnings.

What do you think?

Thanks
--
Gustavo