iommu: return error code when it can't get group
authorYang Yingliang <yangyingliang@huawei.com>
Thu, 26 Nov 2020 13:38:25 +0000 (21:38 +0800)
committerWill Deacon <will@kernel.org>
Thu, 26 Nov 2020 14:53:32 +0000 (14:53 +0000)
Although iommu_group_get() in iommu_probe_device() will always succeed
thanks to __iommu_probe_device() creating the group if it's not present,
it's still worth initialising 'ret' to -ENODEV in case this path is
reachable in the future.

For now, this patch results in no functional change.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20201126133825.3643852-1-yangyingliang@huawei.com
Signed-off-by: Will Deacon <will@kernel.org>
drivers/iommu/iommu.c

index 88b0c9192d8c50a66882308cedde913670bde4c4..dd617ed854a32a42412abbcc034811a2103d484e 100644 (file)
@@ -253,8 +253,10 @@ int iommu_probe_device(struct device *dev)
                goto err_out;
 
        group = iommu_group_get(dev);
-       if (!group)
+       if (!group) {
+               ret = -ENODEV;
                goto err_release;
+       }
 
        /*
         * Try to allocate a default domain - needs support from the