KVM: arm64: Don't return from void function
PATCH 1/1 KVM: arm64: Don't return from void function
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.
--- arch/arm64/kvm/hyp/nvhe/switch.c | 2 +- arch/arm64/kvm/hyp/vhe/switch.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm64/kvm/hyp/nvhe/switch.c +1 -1
@@ -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 (); }
arch/arm64/kvm/hyp/vhe/switch.c +1 -1
@@ -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 (); }
Signature · 6 lines
2.37.0.rc0.161.g10f37bed90-goog _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Quoted 8 lines · Quentin Perret
Although harmless, the return statement in
kvm_unexpected_el2_exceptionis 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.[...]
Applied to kvm-arm64/misc-5.20, thanks!
[1/1] KVM: arm64: Don't return from void function
commit: 1c3ace2b8b3995d3213c5e2d2aca01a0577a3b0f
Cheers,
M.
Signature · 1 line
Marc Zyngier <[email protected]>