* [PATCH] KVM: arm64: Don't return from void function
@ 2022-07-05 14:23 Quentin Perret
2022-07-06 9:00 ` Marc Zyngier
0 siblings, 1 reply; 2+ messages in thread
From: Quentin Perret @ 2022-07-05 14:23 UTC (permalink / raw)
To: Marc Zyngier, James Morse, Alexandru Elisei, Suzuki K Poulose,
Oliver Upton, Catalin Marinas, Will Deacon, linux-arm-kernel,
kvmarm, linux-kernel
Cc: kernel-team, qperret
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>
---
arch/arm64/kvm/hyp/nvhe/switch.c | 2 +-
arch/arm64/kvm/hyp/vhe/switch.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kvm/hyp/nvhe/switch.c b/arch/arm64/kvm/hyp/nvhe/switch.c
index 6db801db8f27..925b34b7708d 100644
--- a/arch/arm64/kvm/hyp/nvhe/switch.c
+++ b/arch/arm64/kvm/hyp/nvhe/switch.c
@@ -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();
}
diff --git a/arch/arm64/kvm/hyp/vhe/switch.c b/arch/arm64/kvm/hyp/vhe/switch.c
index 969f20daf97a..390af1a6a9b4 100644
--- a/arch/arm64/kvm/hyp/vhe/switch.c
+++ b/arch/arm64/kvm/hyp/vhe/switch.c
@@ -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();
}
--
2.37.0.rc0.161.g10f37bed90-goog
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] KVM: arm64: Don't return from void function
2022-07-05 14:23 [PATCH] KVM: arm64: Don't return from void function Quentin Perret
@ 2022-07-06 9:00 ` Marc Zyngier
0 siblings, 0 replies; 2+ messages in thread
From: Marc Zyngier @ 2022-07-06 9:00 UTC (permalink / raw)
To: kvmarm, Will Deacon, Alexandru Elisei, Oliver Upton,
linux-arm-kernel, Catalin Marinas, linux-kernel, Quentin Perret,
James Morse, Suzuki K Poulose
Cc: kernel-team
On Tue, 5 Jul 2022 14:23:10 +0000, Quentin Perret wrote:
> 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.
>
> [...]
Applied to kvm-arm64/misc-5.20, thanks!
[1/1] KVM: arm64: Don't return from void function
commit: 1c3ace2b8b3995d3213c5e2d2aca01a0577a3b0f
Cheers,
M.
--
Marc Zyngier <maz@kernel.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-06 9:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-05 14:23 [PATCH] KVM: arm64: Don't return from void function Quentin Perret
2022-07-06 9:00 ` Marc Zyngier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®