Commit Message

There are several points of improvements:
1) Make kvmppc_free_hpt() check if allocation is made before attempt
to release. This follows kfree(p) semantics where p == NULL.
2) Return initialized @info parameter from kvmppc_allocate_hpt()
even if allocation fails.
This allows to use kvmppc_free_hpt() in the caller without
checking that preceded kvmppc_allocate_hpt() was successful
p = kmalloc(size, gfp);
kfree(p);
which is correct for both p != NULL and p == NULL. Followup
change will rely on this behaviour.
3) Better code reuse: kvmppc_free_hpt() can be reused on error
path in kvmppc_allocate_hpt() to avoid code duplication.
4) No need to check for !hpt if allocated from CMA: neither
pfn_to_kaddr() nor page_to_pfn() is 0 in case of page != NULL.
Signed-off-by: Serhii Popovych <spopovyc@redhat.com>
---
arch/powerpc/kvm/book3s_64_mmu_hv.c | 54 ++++++++++++++++++-------------------
1 file changed, 26 insertions(+), 28 deletions(-)