antoineco / broadcom-wl

Broadcom Linux hybrid wireless driver (64-bit)
https://www.broadcom.com/support/download-search?pg=Wireless+Embedded+Solutions+and+RF+Components&pf=Legacy+Wireless&pa=Driver&dk=BCM4312&l=true
163 stars 47 forks source link

gcc 9.2.0-r2: warning: this statement may fall through [-Wimplicit-fallthrough=] #11

Closed aesophor closed 4 years ago

aesophor commented 4 years ago

Hello, thank you so much for maintaining this open source driver!

The culprit is shown in the below code snippet:

    case NL80211_AUTHTYPE_NETWORK_EAP:
        WL_DBG(("network eap\n"));
    default:
        val = 2;
        WL_ERR(("invalid auth type (%d)\n", sme->auth_type));
        break;

My suggestion is that we should add a single-line comment "// fallthrough" before default, which documents the intention more clearly and also suppresses the warning.

Build log:

> make      
KBUILD_NOPEDANTIC=1 make -C /lib/modules/`uname -r`/build M=`pwd`
make[1]: Entering directory '/usr/src/linux-5.4.28-gentoo'
CFG80211 API is prefered for this kernel version
Using CFG80211 API
  AR      /home/aesophor/Code/broadcom-wl/built-in.a
  CC [M]  /home/aesophor/Code/broadcom-wl/src/shared/linux_osl.o
  CC [M]  /home/aesophor/Code/broadcom-wl/src/wl/sys/wl_linux.o
  CC [M]  /home/aesophor/Code/broadcom-wl/src/wl/sys/wl_iw.o
  CC [M]  /home/aesophor/Code/broadcom-wl/src/wl/sys/wl_cfg80211_hybrid.o
In file included from /home/aesophor/Code/broadcom-wl/src/wl/sys/wl_cfg80211_hybrid.c:43:
/home/aesophor/Code/broadcom-wl/src/wl/sys/wl_cfg80211_hybrid.c: In function ‘wl_set_auth_type’:
/home/aesophor/Code/broadcom-wl/src/wl/sys/wl_cfg80211_hybrid.h:57:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
   57 |  if (wl_dbg_level & WL_DBG_DBG) {   \
      |     ^
/home/aesophor/Code/broadcom-wl/src/wl/sys/wl_cfg80211_hybrid.c:817:3: note: in expansion of macro ‘WL_DBG’
  817 |   WL_DBG(("network eap\n"));
      |   ^~~~~~
/home/aesophor/Code/broadcom-wl/src/wl/sys/wl_cfg80211_hybrid.c:818:2: note: here
  818 |  default:
      |  ^~~~~~~
  LD [M]  /home/aesophor/Code/broadcom-wl/wl.o
CFG80211 API is prefered for this kernel version
Using CFG80211 API
  Building modules, stage 2.
  MODPOST 1 modules
  CC [M]  /home/aesophor/Code/broadcom-wl/wl.mod.o
  LD [M]  /home/aesophor/Code/broadcom-wl/wl.ko
make[1]: Leaving directory '/usr/src/linux-5.4.28-gentoo'