iommu/rockchip: Clarify of_xlate
Subsystems (2)
Robin Murphy
reviewerPATCH 1/1 iommu/rockchip: Clarify of_xlate
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 <[email protected]>
--- drivers/iommu/rockchip-iommu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/iommu/rockchip-iommu.c +6 -2
@@ -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 (&iommu_dev->dev,sizeof (*data),GFP_KERNEL );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 ; }
Signature · 1 line
2.54.0.dirty