Re: [PATCH 1/8] drm/mxsfb/lcdif: simplify remote pointer management using __free

Liu Ying
2026-03-26T06:39:29Z

Hi Luca,

On Fri, Mar 20, 2026 at 11:46:12AM +0100, Luca Ceresoli wrote:
> Putting the remote device_node reference requires a of_node_put(ep) in both

s/of_node_put(ep)/of_node_put(remote)/

> error return points.

Should be cleanup points instead?

> Use a cleanup action to simplify the code.
>
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> ---
> drivers/gpu/drm/mxsfb/lcdif_drv.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/mxsfb/lcdif_drv.c b/drivers/gpu/drm/mxsfb/lcdif_drv.c
> index 47da1d9336b9..756ca96373c8 100644
> --- a/drivers/gpu/drm/mxsfb/lcdif_drv.c
> +++ b/drivers/gpu/drm/mxsfb/lcdif_drv.c
> @@ -53,16 +53,13 @@ static int lcdif_attach_bridge(struct lcdif_drm_private *lcdif)
> int ret;
>
> for_each_endpoint_of_node(dev->of_node, ep) {
> - struct device_node *remote;
> + struct device_node *remote __free(drm_bridge_put) =

s/drm_bridge_put/device_node/, though I know you've already realized the
mistake in a separate reply.

With the above comments addressed:
Reviewed-by: Liu Ying <victor.liu@nxp.com>

> + of_graph_get_remote_port_parent(ep);
> struct of_endpoint of_ep;
> struct drm_encoder *encoder;
>
> - remote = of_graph_get_remote_port_parent(ep);
> - if (!of_device_is_available(remote)) {
> - of_node_put(remote);
> + if (!of_device_is_available(remote))
> continue;
> - }
> - of_node_put(remote);
>
> ret = of_graph_parse_endpoint(ep, &of_ep);
> if (ret < 0) {
>

--
Regards,
Liu Ying