lkml.org 
[lkml]   [2022]   [Aug]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.15 467/779] KVM: arm64: Dont return from void function
    Date
    From: Quentin Perret <qperret@google.com>

    [ Upstream commit 1c3ace2b8b3995d3213c5e2d2aca01a0577a3b0f ]

    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
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    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 a34b01cc8ab9..4db5409f40c4 100644
    --- a/arch/arm64/kvm/hyp/nvhe/switch.c
    +++ b/arch/arm64/kvm/hyp/nvhe/switch.c
    @@ -279,5 +279,5 @@ void __noreturn hyp_panic(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 d88d3c143a73..813e6e2178c1 100644
    --- a/arch/arm64/kvm/hyp/vhe/switch.c
    +++ b/arch/arm64/kvm/hyp/vhe/switch.c
    @@ -220,5 +220,5 @@ void __noreturn hyp_panic(void)

    asmlinkage void kvm_unexpected_el2_exception(void)
    {
    - return __kvm_unexpected_el2_exception();
    + __kvm_unexpected_el2_exception();
    }
    --
    2.35.1


    \
     
     \ /
      Last update: 2022-08-15 21:15    [W:4.093 / U:0.024 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site