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

sunran001 at 208suo.com sunran001 at 208suo.com
Tue Jul 18 01:28:26 PDT 2023


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 at 208suo.com>
---
  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;



More information about the Linux-mediatek mailing list