Re: [GIT PULL] Wimplicit-fallthrough patches for 5.3-rc1

From: Gustavo A. R. Silva
Date: Wed Jul 10 2019 - 14:14:18 EST


Hi Stephen,

On 7/9/19 11:15 PM, Stephen Rothwell wrote:
> Hi Gustavo,
>
> On Tue, 9 Jul 2019 13:20:10 -0500 "Gustavo A. R. Silva" <gustavo@xxxxxxxxxxxxxx> wrote:
>>
>> 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:
> ^~~~

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

> 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:
> ^~~~

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

> 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:
> ^~~~

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

> 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