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
This commit is contained in:
Fabiano Rosas 2022-01-25 12:57:33 -03:00 committed by Michael Ellerman
parent 69ab6ac380
commit c5d0d77b45
1 changed files with 7 additions and 5 deletions

View File

@ -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)