* [PATCH v2] iommu/rockchip: Clarify of_xlate
@ 2026-12-01 13:16 Robin Murphy
2026-12-02 8:40 ` Jörg Rödel
0 siblings, 1 reply; 2+ messages in thread
From: Robin Murphy @ 2026-12-01 13:16 UTC (permalink / raw)
To: joro, will; +Cc: heiko, iommu, linux-rockchip
Technically "leaking" a reference on a platform device which will never
be freed anyway, and only under catastrophic OOM conditions, is entirely
a non-issue. But the number of attempts to "fix" it with additional
pointless checks is getting tiresome (and only made worse by LLMs...),
so let's just hoist the refcount drop up to avoid the offending pattern,
and add a comment on the general of_xlate flow for clarity.
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
v2: Rebase for devm_kzalloc_obj conversion - turns out one should really
pay attention before writing patches on a branch that was left in the
middle of a rebase from yesterday...
drivers/iommu/rockchip-iommu.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
index 1fa3110b142a..f7dc97e64e52 100644
--- a/drivers/iommu/rockchip-iommu.c
+++ b/drivers/iommu/rockchip-iommu.c
@@ -1184,7 +1184,13 @@ static int rk_iommu_of_xlate(struct device *dev,
struct platform_device *iommu_dev;
struct rk_iommudata *data;
+ /*
+ * If we're here at all it's because args->np matched what we passed to
+ * iommu_device_register(), so iommu_dev is by definition valid and
+ * referenced already since this driver is currently bound to it!
+ */
iommu_dev = of_find_device_by_node(args->np);
+ platform_device_put(iommu_dev);
data = devm_kzalloc_obj(&iommu_dev->dev, *data);
if (!data)
@@ -1193,8 +1199,6 @@ static int rk_iommu_of_xlate(struct device *dev,
data->iommu = platform_get_drvdata(iommu_dev);
dev_iommu_priv_set(dev, data);
- platform_device_put(iommu_dev);
-
return 0;
}
--
2.54.0.dirty
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] iommu/rockchip: Clarify of_xlate
2026-12-01 13:16 [PATCH v2] iommu/rockchip: Clarify of_xlate Robin Murphy
@ 2026-12-02 8:40 ` Jörg Rödel
0 siblings, 0 replies; 2+ messages in thread
From: Jörg Rödel @ 2026-12-02 8:40 UTC (permalink / raw)
To: Robin Murphy; +Cc: will, heiko, iommu, linux-rockchip
Applied, thanks Robin.
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-02 8:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 13:16 [PATCH v2] iommu/rockchip: Clarify of_xlate Robin Murphy
2026-12-02 8:40 ` Jörg Rödel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox