All of lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND PATCH v2] iommu/omap: Fix missing put_device() call in omap_iommu_probe_device
@ 2022-06-02 10:29 ` Miaoqian Lin
  0 siblings, 0 replies; 2+ messages in thread
From: Miaoqian Lin @ 2022-06-02 10:29 UTC (permalink / raw)
  To: Joerg Roedel, Will Deacon, Suman Anna, iommu, linux-kernel; +Cc: linmq006

The reference taken by 'of_find_device_by_node()' must be released when
not needed anymore.
Add the corresponding 'put_device()' in the error handling path and
the regular path.

Fixes: ede1c2e7d4dc ("iommu/omap: Store iommu_dev pointer in arch_data")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
changes in v2:
- move put_device() before of_node_put().
- add put_device() in the regular path.

v1 Link: https://lore.kernel.org/r/20220107080428.10873-1-linmq006@gmail.com
v2 Link: https://lore.kernel.org/r/20220301063326.18120-1-linmq006@gmail.com
---
 drivers/iommu/omap-iommu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index d9cf2820c02e..58f3efdac3f7 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -1683,6 +1683,7 @@ static struct iommu_device *omap_iommu_probe_device(struct device *dev)
 
 		oiommu = platform_get_drvdata(pdev);
 		if (!oiommu) {
+			put_device(&pdev->dev);
 			of_node_put(np);
 			kfree(arch_data);
 			return ERR_PTR(-EINVAL);
@@ -1691,6 +1692,7 @@ static struct iommu_device *omap_iommu_probe_device(struct device *dev)
 		tmp->iommu_dev = oiommu;
 		tmp->dev = &pdev->dev;
 
+		put_device(&pdev->dev);
 		of_node_put(np);
 	}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [RESEND PATCH v2] iommu/omap: Fix missing put_device() call in omap_iommu_probe_device
@ 2022-06-02 10:29 ` Miaoqian Lin
  0 siblings, 0 replies; 2+ messages in thread
From: Miaoqian Lin @ 2022-06-02 10:29 UTC (permalink / raw)
  To: Joerg Roedel, Will Deacon, Suman Anna, iommu, linux-kernel; +Cc: linmq006

The reference taken by 'of_find_device_by_node()' must be released when
not needed anymore.
Add the corresponding 'put_device()' in the error handling path and
the regular path.

Fixes: ede1c2e7d4dc ("iommu/omap: Store iommu_dev pointer in arch_data")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
changes in v2:
- move put_device() before of_node_put().
- add put_device() in the regular path.

v1 Link: https://lore.kernel.org/r/20220107080428.10873-1-linmq006@gmail.com
v2 Link: https://lore.kernel.org/r/20220301063326.18120-1-linmq006@gmail.com
---
 drivers/iommu/omap-iommu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index d9cf2820c02e..58f3efdac3f7 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -1683,6 +1683,7 @@ static struct iommu_device *omap_iommu_probe_device(struct device *dev)
 
 		oiommu = platform_get_drvdata(pdev);
 		if (!oiommu) {
+			put_device(&pdev->dev);
 			of_node_put(np);
 			kfree(arch_data);
 			return ERR_PTR(-EINVAL);
@@ -1691,6 +1692,7 @@ static struct iommu_device *omap_iommu_probe_device(struct device *dev)
 		tmp->iommu_dev = oiommu;
 		tmp->dev = &pdev->dev;
 
+		put_device(&pdev->dev);
 		of_node_put(np);
 	}
 
-- 
2.25.1

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-02 10:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-02 10:29 [RESEND PATCH v2] iommu/omap: Fix missing put_device() call in omap_iommu_probe_device Miaoqian Lin
2022-06-02 10:29 ` Miaoqian Lin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.