mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-04 01:49:36 +00:00
powerpc/kvm/book3s_pr: Return appropriate error when allocation fails
err was overwritten by a previous function call, and checked to be 0. If the following page allocation fails, 0 is going to be returned instead of -ENOMEM. Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:
parent
2fb10672c8
commit
e0e1361462
1 changed files with 3 additions and 2 deletions
|
@ -1047,11 +1047,12 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
|
||||||
if (err)
|
if (err)
|
||||||
goto free_shadow_vcpu;
|
goto free_shadow_vcpu;
|
||||||
|
|
||||||
|
err = -ENOMEM;
|
||||||
p = __get_free_page(GFP_KERNEL|__GFP_ZERO);
|
p = __get_free_page(GFP_KERNEL|__GFP_ZERO);
|
||||||
/* the real shared page fills the last 4k of our page */
|
|
||||||
vcpu->arch.shared = (void*)(p + PAGE_SIZE - 4096);
|
|
||||||
if (!p)
|
if (!p)
|
||||||
goto uninit_vcpu;
|
goto uninit_vcpu;
|
||||||
|
/* the real shared page fills the last 4k of our page */
|
||||||
|
vcpu->arch.shared = (void *)(p + PAGE_SIZE - 4096);
|
||||||
|
|
||||||
#ifdef CONFIG_PPC_BOOK3S_64
|
#ifdef CONFIG_PPC_BOOK3S_64
|
||||||
/* default to book3s_64 (970fx) */
|
/* default to book3s_64 (970fx) */
|
||||||
|
|
Loading…
Reference in a new issue