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

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
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -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,12 +6134,17 @@ 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;
	}

	kvm_ops_hv.owner = THIS_MODULE;
	kvmppc_hv_ops = &kvm_ops_hv;

	return 0;
}

static void kvmppc_book3s_exit_hv(void)
{
	kvmppc_uvmem_free();