[PATCH 12/14] iommu/omap: simplify probe_device() error handling

Johan Hovold posted 14 patches 6 days, 12 hours ago
[PATCH 12/14] iommu/omap: simplify probe_device() error handling
Posted by Johan Hovold 6 days, 12 hours ago
Simplify the probe_device() error handling by dropping the iommu OF node
reference sooner.

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/iommu/omap-iommu.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index 77023d49bd24..844def804777 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -1668,23 +1668,20 @@ static struct iommu_device *omap_iommu_probe_device(struct device *dev)
 		}
 
 		pdev = of_find_device_by_node(np);
+		of_node_put(np);
 		if (!pdev) {
-			of_node_put(np);
 			ret = -ENODEV;
 			goto err_put_iommus;
 		}
 
 		oiommu = platform_get_drvdata(pdev);
 		if (!oiommu) {
-			of_node_put(np);
 			ret = -EINVAL;
 			goto err_put_iommus;
 		}
 
 		tmp->iommu_dev = oiommu;
 		tmp->dev = &pdev->dev;
-
-		of_node_put(np);
 	}
 
 	dev_iommu_priv_set(dev, arch_data);
-- 
2.49.1