Re: [PATCH 3/3] drm: logicvc: use automatic cleanup facility for layers_node

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/10/24 - 01:11, Javier Carrasco wrote:
> Use the more robust approach provided by the __free() macro to
> automatically call of_node_put() when the device node goes out of scope.
> 
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@xxxxxxxxx>

Reviewed-by: Louis Chauvet <louis.chauvet@xxxxxxxxxxx>

> ---
>  drivers/gpu/drm/logicvc/logicvc_layer.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/logicvc/logicvc_layer.c b/drivers/gpu/drm/logicvc/logicvc_layer.c
> index 34caf5f0f619..9d7d1b58b002 100644
> --- a/drivers/gpu/drm/logicvc/logicvc_layer.c
> +++ b/drivers/gpu/drm/logicvc/logicvc_layer.c
> @@ -581,12 +581,12 @@ 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 *layers_node;
> +	struct device_node *layers_node __free(device_node) =
> +		of_get_child_by_name(of_node, "layers");
>  	struct logicvc_layer *layer;
>  	struct logicvc_layer *next;
>  	int ret = 0;
>  
> -	layers_node = of_get_child_by_name(of_node, "layers");
>  	if (!layers_node) {
>  		drm_err(drm_dev, "No layers node found in the description\n");
>  		ret = -ENODEV;
> @@ -611,14 +611,10 @@ int logicvc_layers_init(struct logicvc_drm *logicvc)
>  		}
>  
>  		ret = logicvc_layer_init(logicvc, layer_node, index);
> -		if (ret) {
> -			of_node_put(layers_node);
> +		if (ret)
>  			goto error;
> -		}
>  	}
>  
> -	of_node_put(layers_node);
> -
>  	return 0;
>  
>  error:
> 
> -- 
> 2.43.0
> 



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux