'devid' has been checked in function check_device, no need to double
check and clean up this.

Cc: Joerg Roedel <j...@8bytes.org>
Cc: Will Deacon <w...@kernel.org>
Signed-off-by: Shaokun Zhang <zhangshao...@hisilicon.com>
---
 drivers/iommu/amd/iommu.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index b4fa94a97446..cd1a85ff2cf4 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -1677,9 +1677,6 @@ static struct iommu_device *amd_iommu_probe_device(struct 
device *dev)
                return ERR_PTR(-ENODEV);
 
        devid = get_device_id(dev);
-       if (devid < 0)
-               return ERR_PTR(devid);
-
        iommu = amd_iommu_rlookup_table[devid];
 
        if (dev_iommu_priv_get(dev))
@@ -1961,16 +1958,12 @@ static void amd_iommu_detach_device(struct iommu_domain 
*dom,
                                    struct device *dev)
 {
        struct iommu_dev_data *dev_data = dev_iommu_priv_get(dev);
+       int devid = get_device_id(dev);
        struct amd_iommu *iommu;
-       int devid;
 
        if (!check_device(dev))
                return;
 
-       devid = get_device_id(dev);
-       if (devid < 0)
-               return;
-
        if (dev_data->domain != NULL)
                detach_device(dev);
 
-- 
2.7.4

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to