Skip to content

Commit

Permalink
KVM: MMU: Remove some useless code from alloc_mmu_pages()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Wei Yongjun authored and Marcelo Tosatti committed Mar 1, 2010
1 parent 0c04851 commit d7fa6ab
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions arch/x86/kvm/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2843,16 +2843,13 @@ static int alloc_mmu_pages(struct kvm_vcpu *vcpu)
*/
page = alloc_page(GFP_KERNEL | __GFP_DMA32);
if (!page)
goto error_1;
return -ENOMEM;

vcpu->arch.mmu.pae_root = page_address(page);
for (i = 0; i < 4; ++i)
vcpu->arch.mmu.pae_root[i] = INVALID_PAGE;

return 0;

error_1:
free_mmu_pages(vcpu);
return -ENOMEM;
}

int kvm_mmu_create(struct kvm_vcpu *vcpu)
Expand Down

0 comments on commit d7fa6ab

Please sign in to comment.