]> git.baikalelectronics.ru Git - kernel.git/commit
net: ax88796c: Fix clang -Wimplicit-fallthrough in ax88796c_set_mac()
authorNathan Chancellor <nathan@kernel.org>
Mon, 25 Oct 2021 21:12:38 +0000 (14:12 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 26 Oct 2021 13:57:23 +0000 (14:57 +0100)
commit51414fd022bca96e93db07805e6d0616bffc2d9f
tree976833950c68496af13f1d23a4e2540330c2e5f3
parentd1f4d11e43e8bb067661672db8dee9972b901e91
net: ax88796c: Fix clang -Wimplicit-fallthrough in ax88796c_set_mac()

Clang warns:

drivers/net/ethernet/asix/ax88796c_main.c:696:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
        case SPEED_10:
        ^
drivers/net/ethernet/asix/ax88796c_main.c:696:2: note: insert 'break;' to avoid fall-through
        case SPEED_10:
        ^
        break;
drivers/net/ethernet/asix/ax88796c_main.c:706:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
        case DUPLEX_HALF:
        ^
drivers/net/ethernet/asix/ax88796c_main.c:706:2: note: insert 'break;' to avoid fall-through
        case DUPLEX_HALF:
        ^
        break;

Clang is a little more pedantic than GCC, which permits implicit
fallthroughs to cases that contain just break or return. Clang's version
is more in line with the kernel's own stance in deprecated.rst, which
states that all switch/case blocks must end in either break,
fallthrough, continue, goto, or return. Add the missing breaks to fix
the warning.

Link: https://github.com/ClangBuiltLinux/linux/issues/1491
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/asix/ax88796c_main.c