summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorFabiano Rosas <farosas@linux.ibm.com>2022-01-25 12:57:33 -0300
committerMichael Ellerman <mpe@ellerman.id.au>2022-02-03 16:50:44 +1100
commitc5d0d77b45265905bba2ce6e63c9a02bbd11c43c (patch)
tree1bb832a4c942cbd2611bd645a4c544fe87f2220a /arch
parent69ab6ac380a00244575de02c406dcb9491bf3368 (diff)
downloadlinux-stable-c5d0d77b45265905bba2ce6e63c9a02bbd11c43c.tar.gz
KVM: PPC: Book3S HV: Delay setting of kvm ops
Delay the setting of kvm_hv_ops until after all init code has completed. This avoids leaving the ops still accessible if the init fails. Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20220125155735.1018683-3-farosas@linux.ibm.com
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kvm/book3s_hv.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 98ec92cf837b..ec56970175e2 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -6119,9 +6119,6 @@ static int kvmppc_book3s_init_hv(void)
}
#endif
- kvm_ops_hv.owner = THIS_MODULE;
- kvmppc_hv_ops = &kvm_ops_hv;
-
init_default_hcalls();
init_vcore_lists();
@@ -6137,10 +6134,15 @@ static int kvmppc_book3s_init_hv(void)
}
r = kvmppc_uvmem_init();
- if (r < 0)
+ if (r < 0) {
pr_err("KVM-HV: kvmppc_uvmem_init failed %d\n", r);
+ return r;
+ }
- return r;
+ kvm_ops_hv.owner = THIS_MODULE;
+ kvmppc_hv_ops = &kvm_ops_hv;
+
+ return 0;
}
static void kvmppc_book3s_exit_hv(void)