]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: Fix clang -Wimplicit-fallthrough in do_host_cpuid()
authorNathan Chancellor <nathan@kernel.org>
Tue, 22 Mar 2022 15:29:06 +0000 (08:29 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 29 Mar 2022 17:21:18 +0000 (13:21 -0400)
commit754047b51b12c0e02032b46a288b8d1c5db43811
tree042807dc73ffe1fc60c037a39aa133af6d4f28b6
parent56934ebdd6b77c1f28b61f0116e6ebb63f9d0a28
KVM: x86: Fix clang -Wimplicit-fallthrough in do_host_cpuid()

Clang warns:

  arch/x86/kvm/cpuid.c:739:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
          default:
          ^
  arch/x86/kvm/cpuid.c:739:2: note: insert 'break;' to avoid fall-through
          default:
          ^
          break;
  1 error generated.

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: f7cb9809520f ("KVM: x86: synthesize CPUID leaf 0x80000021h if useful")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Message-Id: <20220322152906.112164-1-nathan@kernel.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/cpuid.c