Skip to contentSkip to conversation

KVM: PPC: Book3S HV: remove redundant NULL check

PATCH Applied Chen Zhou 2 participants 2 messages Apr 1, 2020 – May 27, 2020

Subsystems (2)
lore
Share & tools
lore

Chen Zhou

author
#0 lore raw

PATCH 1/1 KVM: PPC: Book3S HV: remove redundant NULL check

Free function kfree() already does NULL check, so the additional check is unnecessary, just remove it.

---
 arch/powerpc/kvm/book3s_hv_nested.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/powerpc/kvm/book3s_hv_nested.c +1 -2
index dc97e5b..cad3243 100644
@@ -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 */
 
Signature · 1 line
2.7.4
#1 lore raw
Quoted 4 lines · Chen Zhou

Free function kfree() already does NULL check, so the additional check is unnecessary, just remove it.

Thanks, applied to my kvm-ppc-next branch.

Paul.