diff mbox series

KVM: x86: Avoid clang -Wimplicit-fallthrough in kvm_vm_ioctl_check_extension()

Message ID 20240905-kvm-x86-avoid-clang-implicit-fallthrough-v1-1-f2e785f1aa45@kernel.org (mailing list archive)
State New, archived
Headers show
Series KVM: x86: Avoid clang -Wimplicit-fallthrough in kvm_vm_ioctl_check_extension() | expand

Commit Message

Nathan Chancellor Sept. 5, 2024, 7:10 p.m. UTC
Clang warns (or errors with CONFIG_WERROR):

  arch/x86/kvm/x86.c:4819:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
   4819 |         default:
        |         ^

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: d30d9ee94cc0 ("KVM: x86: Only advertise KVM_CAP_READONLY_MEM when supported by VM")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 arch/x86/kvm/x86.c | 1 +
 1 file changed, 1 insertion(+)


---
base-commit: 59cbd4eea48fdbc68fc17a29ad71188fea74b28b
change-id: 20240905-kvm-x86-avoid-clang-implicit-fallthrough-6248e3ac5321

Best regards,
diff mbox series

Patch

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 0f801804150e..c983c8e434b8 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4816,6 +4816,7 @@  int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
 		break;
 	case KVM_CAP_READONLY_MEM:
 		r = kvm ? kvm_arch_has_readonly_mem(kvm) : 1;
+		break;
 	default:
 		break;
 	}