[PATCH v2 05/13] iommu/rockchip: Fix error handling in init
Jeffy Chen
jeffy.chen at rock-chips.com
Tue Jan 16 05:25:32 PST 2018
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 at rock-chips.com>
---
Changes in v2:
Move bus_set_iommu() to rk_iommu_probe().
drivers/iommu/rockchip-iommu.c | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
index bd8b32dc0db6..d2a0b0daf40d 100644
--- a/drivers/iommu/rockchip-iommu.c
+++ b/drivers/iommu/rockchip-iommu.c
@@ -1187,6 +1187,8 @@ static int rk_iommu_probe(struct platform_device *pdev)
return err;
}
+ bus_set_iommu(&platform_bus_type, &rk_iommu_ops);
+
return 0;
}
@@ -1218,27 +1220,19 @@ 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;
-
ret = platform_driver_register(&rk_iommu_domain_driver);
if (ret)
return ret;
ret = platform_driver_register(&rk_iommu_driver);
- if (ret)
+ if (ret) {
platform_driver_unregister(&rk_iommu_domain_driver);
- return ret;
+ return ret;
+ }
+
+ return 0;
}
static void __exit rk_iommu_exit(void)
{
--
2.11.0
More information about the linux-arm-kernel
mailing list