KVM: PPC: Book3S HV: Delete an unnecessary check before kfree() in __kvmhv_nested_page_fault()
Subsystems (3)
PATCH 1/1 KVM: PPC: Book3S HV: Delete an unnecessary check before kfree() in __kvmhv_nested_page_fault()
From: Markus Elfring <[email protected]>
Date: Wed, 4 Sep 2019 11:00:20 +0200
The kfree() function tests whether its argument is NULL and then returns immediately.
Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by Markus Elfring <[email protected]>
--- arch/powerpc/kvm/book3s_hv_nested.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/powerpc/kvm/book3s_hv_nested.c +1 -2
@@ -1416,8 +1416,7 @@ static long int __kvmhv_nested_page_fault(struct kvm_run *run, rmapp = &memslot->arch.rmap[gfn - memslot->base_gfn]; ret =kvmppc_create_pte (kvm, gp->shadow_pgtable, pte, n_gpa, level, mmu_seq, gp->shadow_lpid, rmapp, &n_rmap); -if (n_rmap) -kfree (n_rmap); +kfree (n_rmap);if (ret == -EAGAIN ) ret =RESUME_GUEST ;/* Let the guest try again */
--
2.23.0