summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2006-12-22 10:05:28 +0100
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-22 17:55:46 +0100
commit2c264957105b7c248a456ba6602df667ae986550 (patch)
treef4dde78d957602f696af75bfb7a13b1e80c12236 /drivers
parent[PATCH] KVM: AMD SVM: Save and restore the floating point unit state (diff)
downloadlinux-2c264957105b7c248a456ba6602df667ae986550.tar.xz
linux-2c264957105b7c248a456ba6602df667ae986550.zip
[PATCH] KVM: Use more traditional error handling in kvm_mmu_init()
Signed-off-by: Avi Kivity <avi@qumranet.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/kvm/mmu.c18
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)
ASSERT(!VALID_PAGE(vcpu->mmu.root_hpa));
ASSERT(list_empty(&vcpu->free_pages));
- if ((r = alloc_mmu_pages(vcpu)))
- return r;
+ r = alloc_mmu_pages(vcpu);
+ if (r)
+ goto out;
+
+ r = init_kvm_mmu(vcpu);
+ if (r)
+ goto out_free_pages;
- if ((r = init_kvm_mmu(vcpu))) {
- free_mmu_pages(vcpu);
- return r;
- }
return 0;
+
+out_free_pages:
+ free_mmu_pages(vcpu);
+out:
+ return r;
}
void kvm_mmu_destroy(struct kvm_vcpu *vcpu)