KVM: x86: fix error return code in kvm_arch_vcpu_init()
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Wed, 17 Apr 2013 23:41:00 +0000 (07:41 +0800)
committerGleb Natapov <gleb@redhat.com>
Mon, 22 Apr 2013 07:56:44 +0000 (10:56 +0300)
Fix to return a negative error code from the error handling
case instead of 0, as returned elsewhere in this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
arch/x86/kvm/x86.c

index 50e2e10b80416b85a9356f017b1eff347c368d0e..cbe16b4cad5c2c76df07745a8b43319232a95bd4 100644 (file)
@@ -6752,8 +6752,10 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
        }
        vcpu->arch.mcg_cap = KVM_MAX_MCE_BANKS;
 
-       if (!zalloc_cpumask_var(&vcpu->arch.wbinvd_dirty_mask, GFP_KERNEL))
+       if (!zalloc_cpumask_var(&vcpu->arch.wbinvd_dirty_mask, GFP_KERNEL)) {
+               r = -ENOMEM;
                goto fail_free_mce_banks;
+       }
 
        r = fx_init(vcpu);
        if (r)