diff mbox series

[1/3] drm: logicvc: fix missing of_node_put() in for_each_child_of_node()

Message ID 20241011-logicvc_layer_of_node_put-v1-1-1ec36bdca74f@gmail.com (mailing list archive)
State New, archived
Headers show
Series drm: logicvc: add of_node_put() and switch to a more secure approach | expand

Commit Message

Javier Carrasco Oct. 10, 2024, 11:11 p.m. UTC
Early exits from the for_each_child_of_node() loop require explicit
calls to of_node_put() for the child node.

Add the missing 'of_node_put(layer_node)' in the only error path.

Cc: stable@vger.kernel.org
Fixes: efeeaefe9be5 ("drm: Add support for the LogiCVC display controller")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
 drivers/gpu/drm/logicvc/logicvc_layer.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Louis Chauvet Oct. 11, 2024, 1:06 p.m. UTC | #1
On 11/10/24 - 01:11, Javier Carrasco wrote:
> Early exits from the for_each_child_of_node() loop require explicit
> calls to of_node_put() for the child node.
> 
> Add the missing 'of_node_put(layer_node)' in the only error path.
> 
> Cc: stable@vger.kernel.org
> Fixes: efeeaefe9be5 ("drm: Add support for the LogiCVC display controller")
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>

Reviewed-By: Louis Chauvet <louis.chauvet@bootlin.com>

> ---
>  drivers/gpu/drm/logicvc/logicvc_layer.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/logicvc/logicvc_layer.c b/drivers/gpu/drm/logicvc/logicvc_layer.c
> index 464000aea765..52dabacd42ee 100644
> --- a/drivers/gpu/drm/logicvc/logicvc_layer.c
> +++ b/drivers/gpu/drm/logicvc/logicvc_layer.c
> @@ -613,6 +613,7 @@ 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
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/logicvc/logicvc_layer.c b/drivers/gpu/drm/logicvc/logicvc_layer.c
index 464000aea765..52dabacd42ee 100644
--- a/drivers/gpu/drm/logicvc/logicvc_layer.c
+++ b/drivers/gpu/drm/logicvc/logicvc_layer.c
@@ -613,6 +613,7 @@  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;
 		}