diff mbox series

[1/2] net: ax88796c: Fix clang -Wimplicit-fallthrough in ax88796c_set_mac()

Message ID 20211025211238.178768-1-nathan@kernel.org (mailing list archive)
State Accepted
Commit 3c5548812a0cf536b98f8d9f7f9377bd304809c1
Delegated to: Netdev Maintainers
Headers show
Series [1/2] net: ax88796c: Fix clang -Wimplicit-fallthrough in ax88796c_set_mac() | expand

Checks

Context Check Description
netdev/cover_letter success Single patches do not need cover letters
netdev/fixes_present success Fixes tag not required for -next series
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success No Fixes tag
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 14 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success No static functions without inline keyword in header files

Commit Message

Nathan Chancellor Oct. 25, 2021, 9:12 p.m. UTC
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>
---
 drivers/net/ethernet/asix/ax88796c_main.c | 2 ++
 1 file changed, 2 insertions(+)


base-commit: dcd63d4326802cec525de2a4775019849958125c

Comments

patchwork-bot+netdevbpf@kernel.org Oct. 26, 2021, 2:10 p.m. UTC | #1
Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Mon, 25 Oct 2021 14:12:38 -0700 you wrote:
> 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;
> 
> [...]

Here is the summary with links:
  - [1/2] net: ax88796c: Fix clang -Wimplicit-fallthrough in ax88796c_set_mac()
    https://git.kernel.org/netdev/net-next/c/3c5548812a0c
  - [2/2] net: ax88796c: Remove pointless check in ax88796c_open()
    https://git.kernel.org/netdev/net-next/c/971f5c4079ed

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/asix/ax88796c_main.c b/drivers/net/ethernet/asix/ax88796c_main.c
index cfc597f72e3d..cf0f96f93f3b 100644
--- a/drivers/net/ethernet/asix/ax88796c_main.c
+++ b/drivers/net/ethernet/asix/ax88796c_main.c
@@ -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;
@@ -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;