[PATCH] KVM: Use more traditional error handling in kvm_mmu_init()
authorAvi Kivity <avi@qumranet.com>
Fri, 22 Dec 2006 09:05:28 +0000 (01:05 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Fri, 22 Dec 2006 16:55:46 +0000 (08:55 -0800)
Signed-off-by: Avi Kivity <avi@qumranet.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/kvm/mmu.c

index 3d367cbfe1f93ca9ac09a452b0baa9c8cfe262d9..bdffe83b19e8237d7818897cbe687640d28e4c3b 100644 (file)
@@ -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)