]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
powerpc/kvm: Add signed type cast for comparation
authorChen Gang <gang.chen@asianux.com>
Mon, 22 Jul 2013 06:32:35 +0000 (14:32 +0800)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 9 Aug 2013 08:06:51 +0000 (18:06 +1000)
'rmls' is 'unsigned long', lpcr_rmls() will return negative number when
failure occurs, so it need a type cast for comparing.

'lpid' is 'unsigned long', kvmppc_alloc_lpid() return negative number
when failure occurs, so it need a type cast for comparing.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Acked-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/kvm/book3s_hv.c

index 2efa9dde741a1aad3ed206481e9c272a94eb7cdf..7629cd3eb91ad69e9460204a7f7c2e8d081a1084 100644 (file)
@@ -1809,7 +1809,7 @@ static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu)
                rma_size <<= PAGE_SHIFT;
                rmls = lpcr_rmls(rma_size);
                err = -EINVAL;
-               if (rmls < 0) {
+               if ((long)rmls < 0) {
                        pr_err("KVM: Can't use RMA of 0x%lx bytes\n", rma_size);
                        goto out_srcu;
                }
@@ -1874,7 +1874,7 @@ int kvmppc_core_init_vm(struct kvm *kvm)
        /* Allocate the guest's logical partition ID */
 
        lpid = kvmppc_alloc_lpid();
-       if (lpid < 0)
+       if ((long)lpid < 0)
                return -ENOMEM;
        kvm->arch.lpid = lpid;