KVM: PPC: Book3S HV: Remove redundant NULL check
authorChen Zhou <chenzhou10@huawei.com>
Wed, 1 Apr 2020 13:09:03 +0000 (21:09 +0800)
committerPaul Mackerras <paulus@ozlabs.org>
Wed, 27 May 2020 01:39:31 +0000 (11:39 +1000)
Free function kfree() already does NULL check, so the additional
check is unnecessary, just remove it.

Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
arch/powerpc/kvm/book3s_hv_nested.c

index dc97e5be76f6188fc7c32e9d61cb1e4728786359..cad324312040b416da69d28a1f344fb624f4bdb9 100644 (file)
@@ -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 */