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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
 <TYCPR01MB11332D26ECE798C07B83804CF86552@TYCPR01MB11332.jpnprd01.prod.outlook.com>
Date: Thu, 31 Oct 2024 06:58:55 +0000
From: Biju Das <biju.das.jz@...renesas.com>
To: Javier Carrasco <javier.carrasco.cruz@...il.com>, Geert Uytterhoeven
	<geert+renesas@...der.be>, Michael Turquette <mturquette@...libre.com>,
	Stephen Boyd <sboyd@...nel.org>, Kuninori Morimoto
	<kuninori.morimoto.gx@...esas.com>
CC: "linux-renesas-soc@...r.kernel.org" <linux-renesas-soc@...r.kernel.org>,
	"linux-clk@...r.kernel.org" <linux-clk@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 2/2] clk: renesas: cpg-mssr: automate 'soc' node release
 in cpg_mssr_reserved_init()

Hi Javier Carrasco,

Thanks for the patch

> -----Original Message-----
> From: Javier Carrasco <javier.carrasco.cruz@...il.com>
> Sent: 30 October 2024 23:26
> Subject: [PATCH 2/2] clk: renesas: cpg-mssr: automate 'soc' node release in cpg_mssr_reserved_init()
> 
> Switch to a more robust approach by means of the cleanup attribute, which automates the calls to
> of_node_put() when 'soc' goes out of scope.
> 
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@...il.com>
> ---
>  drivers/clk/renesas/renesas-cpg-mssr.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/clk/renesas/renesas-cpg-mssr.c b/drivers/clk/renesas/renesas-cpg-mssr.c
> index 5dc89b1009fe..bf85501709f0 100644
> --- a/drivers/clk/renesas/renesas-cpg-mssr.c
> +++ b/drivers/clk/renesas/renesas-cpg-mssr.c
> @@ -979,7 +979,7 @@ static void __init cpg_mssr_reserved_exit(struct cpg_mssr_priv *priv)  static int
> __init cpg_mssr_reserved_init(struct cpg_mssr_priv *priv,
>  					 const struct cpg_mssr_info *info)  {
> -	struct device_node *soc = of_find_node_by_path("/soc");
> +	struct device_node *soc __free(device_node) =
> +of_find_node_by_path("/soc");

I guess. by looking at [1] and [2], the cleanup function should be of_node_put(), which translates to __free_of_node_put(),
that extracts of_node_put() and execute it for cleanup??

[1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/irqchip/irq-renesas-rzg2l.c?h=next-20241030#n535

[2] https://elixir.bootlin.com/linux/v6.12-rc5/source/include/linux/cleanup.h#L198

Cheers,
Biju

>  	struct device_node *node;
>  	uint32_t args[MAX_PHANDLE_ARGS];
>  	unsigned int *ids = NULL;
> @@ -1022,7 +1022,6 @@ static int __init cpg_mssr_reserved_init(struct cpg_mssr_priv *priv,
> 
>  			ids = krealloc_array(ids, (num + 1), sizeof(*ids), GFP_KERNEL);
>  			if (!ids) {
> -				of_node_put(soc);
>  				of_node_put(it.node);
>  				return -ENOMEM;
>  			}
> @@ -1037,7 +1036,6 @@ static int __init cpg_mssr_reserved_init(struct cpg_mssr_priv *priv,
>  			num++;
>  		}
>  	}
> -	of_node_put(soc);
> 
>  	priv->num_reserved_ids	= num;
>  	priv->reserved_ids	= ids;
> 
> --
> 2.43.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ