Skip to content

Commit

Permalink
net: ax88796c: Fix clang -Wimplicit-fallthrough in ax88796c_set_mac()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Nathan Chancellor authored and David S. Miller committed Oct 26, 2021
1 parent a137c06 commit 3c55488
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/net/ethernet/asix/ax88796c_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ static void ax88796c_set_mac(struct ax88796c_device *ax_local)
switch (ax_local->speed) {
case SPEED_100:
maccr |= MACCR_SPEED_100;
break;
case SPEED_10:
case SPEED_UNKNOWN:
break;
Expand All @@ -703,6 +704,7 @@ static void ax88796c_set_mac(struct ax88796c_device *ax_local)
switch (ax_local->duplex) {
case DUPLEX_FULL:
maccr |= MACCR_SPEED_100;
break;
case DUPLEX_HALF:
case DUPLEX_UNKNOWN:
break;
Expand Down

0 comments on commit 3c55488

Please sign in to comment.