]> Gentwo Git Trees - linux/.git/commitdiff
iommu/omap: simplify probe_device() error handling
authorJohan Hovold <johan@kernel.org>
Mon, 20 Oct 2025 04:53:16 +0000 (06:53 +0200)
committerJoerg Roedel <joerg.roedel@amd.com>
Mon, 17 Nov 2025 08:49:45 +0000 (09:49 +0100)
Simplify the probe_device() error handling by dropping the iommu OF node
reference sooner.

Acked-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
drivers/iommu/omap-iommu.c

index 1c995463cfb0d96e12cf1ad2f9f9fc5f3cca6193..768973b7e511fe937f5ec0adfb96928e1df83c1a 100644 (file)
@@ -1668,8 +1668,8 @@ 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);
                        kfree(arch_data);
                        return ERR_PTR(-ENODEV);
                }
@@ -1677,14 +1677,11 @@ static struct iommu_device *omap_iommu_probe_device(struct device *dev)
                oiommu = platform_get_drvdata(pdev);
                put_device(&pdev->dev);
                if (!oiommu) {
-                       of_node_put(np);
                        kfree(arch_data);
                        return ERR_PTR(-EINVAL);
                }
 
                tmp->iommu_dev = oiommu;
-
-               of_node_put(np);
        }
 
        dev_iommu_priv_set(dev, arch_data);