[PATCH] iommu/mtk_iommu_v1: add missing put_device()

From: sunran001
Date: Tue Jul 18 2023 - 04:28:36 EST


The of_find_device_by_node() takes a reference to the underlying device
structure, we should release that reference.

./drivers/iommu/mtk_iommu_v1.c:669:3-9: ERROR: missing put_device; call
of_find_device_by_node on line 662, but without a corresponding object
release within this function.

Signed-off-by: Ran Sun <sunran001@xxxxxxxxxx>
---
drivers/iommu/mtk_iommu_v1.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index 8a0a5e5d049f..1833d0ce7afe 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -666,6 +666,7 @@ static int mtk_iommu_v1_probe(struct platform_device *pdev)
}
if (!plarbdev->dev.driver) {
of_node_put(larbnode);
+ put_device(&plarbdev->dev);
return -EPROBE_DEFER;
}
data->larb_imu[i].dev = &plarbdev->dev;