]> git.hungrycats.org Git - linux/commitdiff
iommu/arm-smmu: fix a signedness bug
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 21 Aug 2013 08:33:30 +0000 (09:33 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Oct 2013 01:14:27 +0000 (18:14 -0700)
commit faea13b72dbdb77e4d6ad83344596486611708b0 upstream.

Unsigned char is never equal to -1.

Tested-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iommu/arm-smmu.c

index ebd0a4cff049a7479a32884d6ed86199208b7b94..32b22ec5aad156fd1cb7c59059cbf41343cc6501 100644 (file)
@@ -379,6 +379,7 @@ struct arm_smmu_cfg {
        u32                             cbar;
        pgd_t                           *pgd;
 };
+#define INVALID_IRPTNDX                        0xff
 
 struct arm_smmu_domain {
        /*
@@ -830,7 +831,7 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain,
        if (IS_ERR_VALUE(ret)) {
                dev_err(smmu->dev, "failed to request context IRQ %d (%u)\n",
                        root_cfg->irptndx, irq);
-               root_cfg->irptndx = -1;
+               root_cfg->irptndx = INVALID_IRPTNDX;
                goto out_free_context;
        }
 
@@ -855,7 +856,7 @@ static void arm_smmu_destroy_domain_context(struct iommu_domain *domain)
        if (!smmu)
                return;
 
-       if (root_cfg->irptndx != -1) {
+       if (root_cfg->irptndx != INVALID_IRPTNDX) {
                irq = smmu->irqs[smmu->num_global_irqs + root_cfg->irptndx];
                free_irq(irq, domain);
        }