KVM: PPC: Decrement module refcount if init_vm fails
authorFabiano Rosas <farosas@linux.ibm.com>
Tue, 25 Jan 2022 15:57:35 +0000 (12:57 -0300)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 3 Feb 2022 05:50:44 +0000 (16:50 +1100)
commit4feb74aa64b35b21a4937f96d7a940adee286e5b
treefd9c309897044cee4ba29566be056971ac9582ba
parent175be7e5800e2782a7e38ee9e1b64633494c4b44
KVM: PPC: Decrement module refcount if init_vm fails

We increment the reference count for KVM-HV/PR before the call to
kvmppc_core_init_vm. If that function fails we need to decrement the
refcount.

Also remove the check on kvm_ops->owner because try_module_get can
handle a NULL module.

Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220125155735.1018683-5-farosas@linux.ibm.com
arch/powerpc/kvm/powerpc.c