KVM: arm64: Don't return from void function
authorQuentin Perret <qperret@google.com>
Tue, 5 Jul 2022 14:23:10 +0000 (14:23 +0000)
committerMarc Zyngier <maz@kernel.org>
Wed, 6 Jul 2022 09:00:31 +0000 (10:00 +0100)
Although harmless, the return statement in kvm_unexpected_el2_exception
is rather confusing as the function itself has a void return type. The
C standard is also pretty clear that "A return statement with an
expression shall not appear in a function whose return type is void".
Given that this return statement does not seem to add any actual value,
let's not pointlessly violate the standard.

Build-tested with GCC 10 and CLANG 13 for good measure, the disassembled
code is identical with or without the return statement.

Fixes: e9ee186bb735 ("KVM: arm64: Add kvm_extable for vaxorcism code")
Signed-off-by: Quentin Perret <qperret@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220705142310.3847918-1-qperret@google.com
arch/arm64/kvm/hyp/nvhe/switch.c
arch/arm64/kvm/hyp/vhe/switch.c

index 6db801d..925b34b 100644 (file)
@@ -386,5 +386,5 @@ asmlinkage void __noreturn hyp_panic_bad_stack(void)
 
 asmlinkage void kvm_unexpected_el2_exception(void)
 {
-       return __kvm_unexpected_el2_exception();
+       __kvm_unexpected_el2_exception();
 }
index 969f20d..390af1a 100644 (file)
@@ -249,5 +249,5 @@ void __noreturn hyp_panic(void)
 
 asmlinkage void kvm_unexpected_el2_exception(void)
 {
-       return __kvm_unexpected_el2_exception();
+       __kvm_unexpected_el2_exception();
 }