KVM: arm64: Simplify return logic in user_mem_abort()

With the refactoring done, the final return block of user_mem_abort()
can be tidied up a bit more.

Clean up the trailing edge by dropping the unnecessary assignment,
collapsing the return evaluation for kvm_s2_fault_compute_prot(), and
tail calling kvm_s2_fault_map() directly.

Signed-off-by: Fuad Tabba <tabba@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
This commit is contained in:
Fuad Tabba 2026-03-06 14:02:28 +00:00 committed by Marc Zyngier
parent 9a57bc1b3c
commit 3825373b91

View File

@ -2005,22 +2005,13 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
if (ret != 1)
return ret;
ret = 0;
ret = kvm_s2_fault_compute_prot(fault);
if (ret == 1) {
ret = 1; /* fault injected */
goto out_put_page;
if (ret) {
kvm_release_page_unused(fault->page);
return ret;
}
if (ret)
goto out_put_page;
ret = kvm_s2_fault_map(fault, memcache);
return ret;
out_put_page:
kvm_release_page_unused(fault->page);
return ret;
return kvm_s2_fault_map(fault, memcache);
}
/* Resolve the access fault by making the page young again. */