iommu/rockchip: fix devm_request_irq and devm_free_irq parameter
authorSimon <xxm@rock-chips.com>
Fri, 25 Mar 2016 01:57:24 +0000 (09:57 +0800)
committerGerrit Code Review <gerrit@rock-chips.com>
Fri, 25 Mar 2016 03:42:58 +0000 (11:42 +0800)
When rk_iommu_attach_device or rk_iommu_detach_device be called, the second
parameter "dev" represent the device who own the iommu, so it is not resonable
using "dev" for devm_request_irq's first parameter. To avoid potential error,
we must use iommu device itself "iommu->dev" instead, the same as devm_free_irq.

Change-Id: Id9f4097d6f1b916308475854dcf75ce86d9494fc
Signed-off-by: Simon <xxm@rock-chips.com>
drivers/iommu/rockchip-iommu.c

index 7f848a202d1f51c9c9a26d2a4b89d877e83366c5..cd6c40a74b72067c6d4dc2a360649eb7314db55d 100644 (file)
@@ -805,7 +805,7 @@ static int rk_iommu_attach_device(struct iommu_domain *domain,
 
        iommu->domain = domain;
 
-       ret = devm_request_irq(dev, iommu->irq, rk_iommu_irq,
+       ret = devm_request_irq(iommu->dev, iommu->irq, rk_iommu_irq,
                               IRQF_SHARED, dev_name(dev), iommu);
        if (ret)
                return ret;
@@ -858,7 +858,7 @@ static void rk_iommu_detach_device(struct iommu_domain *domain,
        }
        rk_iommu_disable_stall(iommu);
 
-       devm_free_irq(dev, iommu->irq, iommu);
+       devm_free_irq(iommu->dev, iommu->irq, iommu);
 
        iommu->domain = NULL;