Thread (30 messages) 30 messages, 7 authors, 3d ago

Re: [PATCH v2 08/19] iommu/fsl: use platform_device_set_of_node()

From: Frank Li <hidden>
Date: 2026-06-29 14:08:51
Also in: dri-devel, driver-core, imx, intel-xe, linux-arm-msm, linux-devicetree, linux-i2c, linux-iommu, linux-mips, linux-pm, linux-sound, linux-usb, lkml, netdev, platform-driver-x86

On Mon, Jun 29, 2026 at 11:12:31AM +0200, Bartosz Golaszewski wrote:
quoted hunk ↗ jump to hunk
[You don't often get email from bartosz.golaszewski@oss.qualcomm.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

Ahead of reworking the reference counting logic for platform devices,
encapsulate the assignment of the OF node for dynamically allocated
platform devices with the provided helper.

Acked-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Bartosz Golaszewski <redacted>
---
 drivers/iommu/fsl_pamu.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/iommu/fsl_pamu.c b/drivers/iommu/fsl_pamu.c
index 25aa477a95a95cb4fa4e132727cde0a936750ee2..012839fa0d8a27cafc6a441373f4f6da794388c1 100644
--- a/drivers/iommu/fsl_pamu.c
+++ b/drivers/iommu/fsl_pamu.c
@@ -973,7 +973,8 @@ static __init int fsl_pamu_init(void)
                ret = -ENOMEM;
                goto error_device_alloc;
        }
-       pdev->dev.of_node = of_node_get(np);
+
+       platform_device_set_of_node(pdev, np);

        ret = pamu_domain_init();
        if (ret)
@@ -985,12 +986,10 @@ static __init int fsl_pamu_init(void)
                goto error_device_add;
        }

+       of_node_put(np);
there are other place miss of_node_put() at error pass.

Can you use auto cleanup

struct device_node *np __free(device_node) = of_find_compatible_node().

Frank
        return 0;

 error_device_add:
-       of_node_put(pdev->dev.of_node);
-       pdev->dev.of_node = NULL;
-
        platform_device_put(pdev);

 error_device_alloc:

--
2.47.3
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help