aboutsummaryrefslogtreecommitdiff
path: root/arch/powerpc/kvm/powerpc.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kvm/powerpc.c')
-rw-r--r--arch/powerpc/kvm/powerpc.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index fd978f681b66..173f57e0a1b5 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -729,14 +729,20 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)
if (!vcpu)
return ERR_PTR(-ENOMEM);
- err = kvmppc_core_vcpu_create(kvm, vcpu, id);
+ err = kvm_vcpu_init(vcpu, kvm, id);
if (err)
goto free_vcpu;
+ err = kvmppc_core_vcpu_create(vcpu);
+ if (err)
+ goto uninit_vcpu;
+
vcpu->arch.wqp = &vcpu->wq;
kvmppc_create_vcpu_debugfs(vcpu, id);
return vcpu;
+uninit_vcpu:
+ kvm_vcpu_uninit(vcpu);
free_vcpu:
kmem_cache_free(kvm_vcpu_cache, vcpu);
return ERR_PTR(err);
@@ -770,6 +776,8 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
kvmppc_core_vcpu_free(vcpu);
+ kvm_vcpu_uninit(vcpu);
+
kmem_cache_free(kvm_vcpu_cache, vcpu);
}