Hi Peng,
> -----Original Message-----
> From: Peng Fan (OSS) <[email protected]>
> Sent: Sunday, September 28, 2025 3:48 AM
> To: Shenwei Wang <[email protected]>
> Cc: Bjorn Andersson <[email protected]>; Mathieu Poirier
> <[email protected]>; Rob Herring <[email protected]>; Krzysztof
> Kozlowski <[email protected]>; Conor Dooley <[email protected]>; Shawn
> Guo <[email protected]>; Sascha Hauer <[email protected]>; Linus
> Walleij <[email protected]>; Bartosz Golaszewski <[email protected]>;
> Pengutronix Kernel Team <[email protected]>; Fabio Estevam
> <[email protected]>; Peng Fan <[email protected]>; linux-
> [email protected]; [email protected]; [email protected];
> >+
> >+ drvdata->rpdev = rpdev;
> >+ auxdata[0].compatible = channel_device_map[i][1];
> >+ auxdata[0].platform_data = drvdata;
> >+ dev_set_drvdata(dev, drvdata);
> >+
> >+ of_platform_populate(drvdata->channel_node, NULL, auxdata, dev);
> >+ of_node_put(drvdata->channel_node);
>
> of_platform_populate will decrement the reference to drvdata->channel_node
> before it return. I not see other places increment the reference to
> channel_node,
> of_node_put here could be removed.
>
The of_node_put is to balance the reference counter which is increased by
of_get_child_by_name in imx_of_rpmsg_node_init function.
+static int imx_of_rpmsg_node_init(struct platform_device *pdev)
+{
...
+ for (i = 0; i < count; i++) {
+ ret = -ENOMEM;
+ channel = of_get_child_by_name(np, channel_device_map[i][0]);
Thanks,
Shenwei
> >+
> >+ return 0;
> >+}
> >+
> >+static int imx_of_rpmsg_node_init(struct platform_device *pdev) {
> >+ struct device_node *np __free(device_node), *channel;
> >+ struct imx_rpmsg_driver_data *driver_data;
> >+ struct imx_rpmsg_driver *rp_driver;
> >+ struct rpmsg_device_id *rpdev_id;
> >+ int i, ret;
> >+
> >+ int count = ARRAY_SIZE(channel_device_map);
> >+ struct device *dev = &pdev->dev;
> >+