Commit d7fa6ab2 authored by Wei Yongjun's avatar Wei Yongjun Committed by Marcelo Tosatti

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: default avatarWei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent 0c04851c
...@@ -2843,16 +2843,13 @@ static int alloc_mmu_pages(struct kvm_vcpu *vcpu) ...@@ -2843,16 +2843,13 @@ static int alloc_mmu_pages(struct kvm_vcpu *vcpu)
*/ */
page = alloc_page(GFP_KERNEL | __GFP_DMA32); page = alloc_page(GFP_KERNEL | __GFP_DMA32);
if (!page) if (!page)
goto error_1; return -ENOMEM;
vcpu->arch.mmu.pae_root = page_address(page); vcpu->arch.mmu.pae_root = page_address(page);
for (i = 0; i < 4; ++i) for (i = 0; i < 4; ++i)
vcpu->arch.mmu.pae_root[i] = INVALID_PAGE; vcpu->arch.mmu.pae_root[i] = INVALID_PAGE;
return 0; return 0;
error_1:
free_mmu_pages(vcpu);
return -ENOMEM;
} }
int kvm_mmu_create(struct kvm_vcpu *vcpu) int kvm_mmu_create(struct kvm_vcpu *vcpu)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment