summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/rockchip-iommu.c
diff options
context:
space:
mode:
authorJeffy Chen <jeffy.chen@rock-chips.com>2018-03-23 08:38:12 +0100
committerJoerg Roedel <jroedel@suse.de>2018-03-29 12:22:28 +0200
commit4d88a8a4c345cd16f634df855148cfb2a59a204a (patch)
tree219e1abe1477743cab3db750d81285921651ccb3 /drivers/iommu/rockchip-iommu.c
parentiommu/rockchip: Use OF_IOMMU to attach devices automatically (diff)
downloadlinux-4d88a8a4c345cd16f634df855148cfb2a59a204a.tar.xz
linux-4d88a8a4c345cd16f634df855148cfb2a59a204a.zip
iommu/rockchip: Fix error handling in init
It's hard to undo bus_set_iommu() in the error path, so move it to the end of rk_iommu_probe(). Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> Reviewed-by: Tomasz Figa <tfiga@chromium.org> Reviewed-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/rockchip-iommu.c')
-rw-r--r--drivers/iommu/rockchip-iommu.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
index bd8580b897e9..0ce5e8a0658c 100644
--- a/drivers/iommu/rockchip-iommu.c
+++ b/drivers/iommu/rockchip-iommu.c
@@ -1133,6 +1133,8 @@ static int rk_iommu_probe(struct platform_device *pdev)
if (!dma_dev)
dma_dev = &pdev->dev;
+ bus_set_iommu(&platform_bus_type, &rk_iommu_ops);
+
return 0;
err_remove_sysfs:
iommu_device_sysfs_remove(&iommu->iommu);
@@ -1176,19 +1178,6 @@ static struct platform_driver rk_iommu_driver = {
static int __init rk_iommu_init(void)
{
- struct device_node *np;
- int ret;
-
- np = of_find_matching_node(NULL, rk_iommu_dt_ids);
- if (!np)
- return 0;
-
- of_node_put(np);
-
- ret = bus_set_iommu(&platform_bus_type, &rk_iommu_ops);
- if (ret)
- return ret;
-
return platform_driver_register(&rk_iommu_driver);
}
subsys_initcall(rk_iommu_init);