Commit c5d0d77b authored by Fabiano Rosas's avatar Fabiano Rosas Committed by Michael Ellerman

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: default avatarFabiano Rosas <farosas@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220125155735.1018683-3-farosas@linux.ibm.com
parent 69ab6ac3
...@@ -6119,9 +6119,6 @@ static int kvmppc_book3s_init_hv(void) ...@@ -6119,9 +6119,6 @@ static int kvmppc_book3s_init_hv(void)
} }
#endif #endif
kvm_ops_hv.owner = THIS_MODULE;
kvmppc_hv_ops = &kvm_ops_hv;
init_default_hcalls(); init_default_hcalls();
init_vcore_lists(); init_vcore_lists();
...@@ -6137,10 +6134,15 @@ static int kvmppc_book3s_init_hv(void) ...@@ -6137,10 +6134,15 @@ static int kvmppc_book3s_init_hv(void)
} }
r = kvmppc_uvmem_init(); r = kvmppc_uvmem_init();
if (r < 0) if (r < 0) {
pr_err("KVM-HV: kvmppc_uvmem_init failed %d\n", r); 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) static void kvmppc_book3s_exit_hv(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment