[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zwkhuyq39LQSZCIN@louis-chauvet-laptop>
Date: Fri, 11 Oct 2024 15:01:47 +0200
From: Louis Chauvet <louis.chauvet@...tlin.com>
To: Javier Carrasco <javier.carrasco.cruz@...il.com>
Cc: Paul Kocialkowski <paul.kocialkowski@...tlin.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] drm: logicvc: switch to
for_each_child_of_node_scoped()
Hi,
I think you can squash this commit with the prvious one, I don't think
this is needed to add of_node_put and remove it just after.
Thanks,
Louis Chauvet
On 11/10/24 - 01:11, Javier Carrasco wrote:
> Use the scoped variant of the macro to avoid leaking memory upon early
> exits without the required call to of_node_put().
>
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@...il.com>
> ---
> drivers/gpu/drm/logicvc/logicvc_layer.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/logicvc/logicvc_layer.c b/drivers/gpu/drm/logicvc/logicvc_layer.c
> index 52dabacd42ee..34caf5f0f619 100644
> --- a/drivers/gpu/drm/logicvc/logicvc_layer.c
> +++ b/drivers/gpu/drm/logicvc/logicvc_layer.c
> @@ -581,7 +581,6 @@ int logicvc_layers_init(struct logicvc_drm *logicvc)
> struct drm_device *drm_dev = &logicvc->drm_dev;
> struct device *dev = drm_dev->dev;
> struct device_node *of_node = dev->of_node;
> - struct device_node *layer_node = NULL;
> struct device_node *layers_node;
> struct logicvc_layer *layer;
> struct logicvc_layer *next;
> @@ -594,7 +593,7 @@ int logicvc_layers_init(struct logicvc_drm *logicvc)
> goto error;
> }
>
> - for_each_child_of_node(layers_node, layer_node) {
> + for_each_child_of_node_scoped(layers_node, layer_node) {
> u32 index = 0;
>
> if (!logicvc_of_node_is_layer(layer_node))
> @@ -613,7 +612,6 @@ int logicvc_layers_init(struct logicvc_drm *logicvc)
>
> ret = logicvc_layer_init(logicvc, layer_node, index);
> if (ret) {
> - of_node_put(layer_node);
> of_node_put(layers_node);
> goto error;
> }
>
> --
> 2.43.0
>
Powered by blists - more mailing lists