Skip to content

Commit 3c55488

Browse files
nathanchancedavem330
authored andcommitted
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: ClangBuiltLinux/linux#1491 Signed-off-by: Nathan Chancellor <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a137c06 commit 3c55488

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/ethernet/asix/ax88796c_main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,7 @@ static void ax88796c_set_mac(struct ax88796c_device *ax_local)
693693
switch (ax_local->speed) {
694694
case SPEED_100:
695695
maccr |= MACCR_SPEED_100;
696+
break;
696697
case SPEED_10:
697698
case SPEED_UNKNOWN:
698699
break;
@@ -703,6 +704,7 @@ static void ax88796c_set_mac(struct ax88796c_device *ax_local)
703704
switch (ax_local->duplex) {
704705
case DUPLEX_FULL:
705706
maccr |= MACCR_SPEED_100;
707+
break;
706708
case DUPLEX_HALF:
707709
case DUPLEX_UNKNOWN:
708710
break;

0 commit comments

Comments
 (0)