Skip to content

Commit c5d0d77

Browse files
farosasmpe
authored andcommitted
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
1 parent 69ab6ac commit c5d0d77

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

arch/powerpc/kvm/book3s_hv.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6119,9 +6119,6 @@ static int kvmppc_book3s_init_hv(void)
61196119
}
61206120
#endif
61216121

6122-
kvm_ops_hv.owner = THIS_MODULE;
6123-
kvmppc_hv_ops = &kvm_ops_hv;
6124-
61256122
init_default_hcalls();
61266123

61276124
init_vcore_lists();
@@ -6137,10 +6134,15 @@ static int kvmppc_book3s_init_hv(void)
61376134
}
61386135

61396136
r = kvmppc_uvmem_init();
6140-
if (r < 0)
6137+
if (r < 0) {
61416138
pr_err("KVM-HV: kvmppc_uvmem_init failed %d\n", r);
6139+
return r;
6140+
}
61426141

6143-
return r;
6142+
kvm_ops_hv.owner = THIS_MODULE;
6143+
kvmppc_hv_ops = &kvm_ops_hv;
6144+
6145+
return 0;
61446146
}
61456147

61466148
static void kvmppc_book3s_exit_hv(void)

0 commit comments

Comments
 (0)