diff options
author | Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com> | 2013-07-17 11:10:29 -0400 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2013-08-28 10:26:33 -0400 |
commit | 7c7b406e6b2867b8dcd638519e42b199ae222358 (patch) | |
tree | 88e5a3bb9749090b2e2a43c7953cfe713d9218a7 /arch/powerpc/kvm | |
parent | 5d226ae56f4dee608099daa599d9df0d12e3b006 (diff) |
KVM: PPC: 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: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/kvm')
-rw-r--r-- | arch/powerpc/kvm/book3s_pr.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c index ddfaf560e503..19cbac6f9d03 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) | |||
1047 | if (err) | 1047 | if (err) |
1048 | goto free_shadow_vcpu; | 1048 | goto free_shadow_vcpu; |
1049 | 1049 | ||
1050 | err = -ENOMEM; | ||
1050 | p = __get_free_page(GFP_KERNEL|__GFP_ZERO); | 1051 | p = __get_free_page(GFP_KERNEL|__GFP_ZERO); |
1051 | /* the real shared page fills the last 4k of our page */ | ||
1052 | vcpu->arch.shared = (void*)(p + PAGE_SIZE - 4096); | ||
1053 | if (!p) | 1052 | if (!p) |
1054 | goto uninit_vcpu; | 1053 | goto uninit_vcpu; |
1054 | /* the real shared page fills the last 4k of our page */ | ||
1055 | vcpu->arch.shared = (void *)(p + PAGE_SIZE - 4096); | ||
1055 | 1056 | ||
1056 | #ifdef CONFIG_PPC_BOOK3S_64 | 1057 | #ifdef CONFIG_PPC_BOOK3S_64 |
1057 | /* default to book3s_64 (970fx) */ | 1058 | /* default to book3s_64 (970fx) */ |