diff options
-rw-r--r-- | drivers/kvm/mmu.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c index 3d367cbfe1f9..bdffe83b19e8 100644 --- a/drivers/kvm/mmu.c +++ b/drivers/kvm/mmu.c | |||
@@ -647,14 +647,20 @@ int kvm_mmu_init(struct kvm_vcpu *vcpu) | |||
647 | ASSERT(!VALID_PAGE(vcpu->mmu.root_hpa)); | 647 | ASSERT(!VALID_PAGE(vcpu->mmu.root_hpa)); |
648 | ASSERT(list_empty(&vcpu->free_pages)); | 648 | ASSERT(list_empty(&vcpu->free_pages)); |
649 | 649 | ||
650 | if ((r = alloc_mmu_pages(vcpu))) | 650 | r = alloc_mmu_pages(vcpu); |
651 | return r; | 651 | if (r) |
652 | goto out; | ||
653 | |||
654 | r = init_kvm_mmu(vcpu); | ||
655 | if (r) | ||
656 | goto out_free_pages; | ||
652 | 657 | ||
653 | if ((r = init_kvm_mmu(vcpu))) { | ||
654 | free_mmu_pages(vcpu); | ||
655 | return r; | ||
656 | } | ||
657 | return 0; | 658 | return 0; |
659 | |||
660 | out_free_pages: | ||
661 | free_mmu_pages(vcpu); | ||
662 | out: | ||
663 | return r; | ||
658 | } | 664 | } |
659 | 665 | ||
660 | void kvm_mmu_destroy(struct kvm_vcpu *vcpu) | 666 | void kvm_mmu_destroy(struct kvm_vcpu *vcpu) |