On 11/10/24 - 15:01, Louis Chauvet wrote: > 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. Forget this, I missed the Fixes in the first commit, sorry for the noise. Reviewed-by: Louis Chauvet <louis.chauvet@xxxxxxxxxxx> > 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@xxxxxxxxx> > > --- > > 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 > >