diff options
author | Wei Yongjun <yjwei@cn.fujitsu.com> | 2010-01-22 03:55:05 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2010-03-01 10:36:05 -0500 |
commit | d7fa6ab217aeed26293e01d7b64f79a1ac57e823 (patch) | |
tree | 3a9a3d829ca9e3df18d43aa01591ee3635828c4e | |
parent | 0c04851c0c093ce98ab4ca69556480d779292418 (diff) |
KVM: MMU: Remove some useless code from alloc_mmu_pages()
If we fail to alloc page for vcpu->arch.mmu.pae_root, call to
free_mmu_pages() is unnecessary, which just do free the page
malloc for vcpu->arch.mmu.pae_root.
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
-rw-r--r-- | arch/x86/kvm/mmu.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 599c422c390f..dc4d954efacd 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -2843,16 +2843,13 @@ static int alloc_mmu_pages(struct kvm_vcpu *vcpu) | |||
2843 | */ | 2843 | */ |
2844 | page = alloc_page(GFP_KERNEL | __GFP_DMA32); | 2844 | page = alloc_page(GFP_KERNEL | __GFP_DMA32); |
2845 | if (!page) | 2845 | if (!page) |
2846 | goto error_1; | 2846 | return -ENOMEM; |
2847 | |||
2847 | vcpu->arch.mmu.pae_root = page_address(page); | 2848 | vcpu->arch.mmu.pae_root = page_address(page); |
2848 | for (i = 0; i < 4; ++i) | 2849 | for (i = 0; i < 4; ++i) |
2849 | vcpu->arch.mmu.pae_root[i] = INVALID_PAGE; | 2850 | vcpu->arch.mmu.pae_root[i] = INVALID_PAGE; |
2850 | 2851 | ||
2851 | return 0; | 2852 | return 0; |
2852 | |||
2853 | error_1: | ||
2854 | free_mmu_pages(vcpu); | ||
2855 | return -ENOMEM; | ||
2856 | } | 2853 | } |
2857 | 2854 | ||
2858 | int kvm_mmu_create(struct kvm_vcpu *vcpu) | 2855 | int kvm_mmu_create(struct kvm_vcpu *vcpu) |