Skip to content

Commit

Permalink
x86/boot: Address clang -Wimplicit-fallthrough in vsprintf()
Browse files Browse the repository at this point in the history
After enabling -Wimplicit-fallthrough for the x86 boot code, clang
warns:

  arch/x86/boot/printf.c:257:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
    257 |                 case 'u':
        |                 ^

Clang is a little more pedantic than GCC, which does not warn when
falling through to a case that is 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 break to silence
the warning.

Fixes: dd0716c ("x86/boot: Add a fallthrough annotation")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Justin Stitt <justinstitt@google.com>
Link: https://lore.kernel.org/r/20240516-x86-boot-fix-clang-implicit-fallthrough-v1-1-04dc320ca07c@kernel.org

Closes: https://lore.kernel.org/oe-kbuild-all/202405162054.ryP73vy1-lkp@intel.com/
  • Loading branch information
Nathan Chancellor authored and Ingo Molnar committed May 17, 2024
1 parent dd0716c commit 82110ae
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/x86/boot/printf.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ int vsprintf(char *buf, const char *fmt, va_list args)
case 'd':
case 'i':
flags |= SIGN;
break;

case 'u':
break;

Expand Down

0 comments on commit 82110ae

Please sign in to comment.