[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9ffe66a3-f091-40c0-92ca-4950610dfd8a@kernel.org>
Date: Thu, 31 Oct 2024 12:07:39 +0100
From: Krzysztof Kozlowski <krzk@...nel.org>
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-clk@...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()
On 31/10/2024 00:25, Javier Carrasco wrote:
> 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");
> 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);
You just added this. Don't add code which is immediately removed. It's a
noop or wrong code.
Best regards,
Krzysztof
Powered by blists - more mailing lists