test_mmio_ease() returns early and skips the call to kvm_vm_free() when
ID_AA64PFR1_EL1 is not available.

Use a goto so that the early return joins the common exit path.

Reported-by: Gokul K <[email protected]>
Link: https://lore.kernel.org/all/[email protected]/
Fixes: a90aac553249 ("KVM: arm64: selftests: Test SEAs are taken to SError 
vector when EASE=1")
Signed-off-by: Tharit Tangkijwanichakul <[email protected]>
---
Tested on a Rock 5B (RK3588). ID_AA64PFR1_EL1.DF2 is not implemented,
so test_mmio_ease() takes the skip path exercised by this fix.
---
 tools/testing/selftests/kvm/arm64/external_aborts.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/kvm/arm64/external_aborts.c 
b/tools/testing/selftests/kvm/arm64/external_aborts.c
index d8fe17a6cc59..7836756a38a6 100644
--- a/tools/testing/selftests/kvm/arm64/external_aborts.c
+++ b/tools/testing/selftests/kvm/arm64/external_aborts.c
@@ -339,7 +339,7 @@ static void test_mmio_ease(void)
        pfr1 = vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_ID_AA64PFR1_EL1));
        if (!SYS_FIELD_GET(ID_AA64PFR1_EL1, DF2, pfr1)) {
                pr_debug("Skipping %s\n", __func__);
-               return;
+               goto done;
        }
 
        /*
@@ -356,6 +356,7 @@ static void test_mmio_ease(void)
 
        vcpu_inject_sea(vcpu);
        vcpu_run_expect_done(vcpu);
+done:
        kvm_vm_free(vm);
 }
 
-- 
2.47.3


Reply via email to