lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZwkhuixQ8sM5pNs7@louis-chauvet-laptop>
Date: Fri, 11 Oct 2024 15:01:46 +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 3/3] drm: logicvc: use automatic cleanup facility for
 layers_node

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@...il.com>

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

> ---
>  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
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ