summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>2013-07-17 12:10:29 -0300
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-08-09 18:06:54 +1000
commite0e13614626bfb5a88678fd951d728ed40e3cbf6 (patch)
tree34ef657486ca32b5c0de2026ed6864dbecb5b2e9
parent2fb10672c828f6e08f1dbe3690167300035adddc (diff)
downloadop-kernel-dev-e0e13614626bfb5a88678fd951d728ed40e3cbf6.zip
op-kernel-dev-e0e13614626bfb5a88678fd951d728ed40e3cbf6.tar.gz
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>
-rw-r--r--arch/powerpc/kvm/book3s_pr.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index 19498a5..c6e13d9 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -1047,11 +1047,12 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
if (err)
goto free_shadow_vcpu;
+ err = -ENOMEM;
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)
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
/* default to book3s_64 (970fx) */
OpenPOWER on IntegriCloud