[PATCH 3/7] clk: st: clkgen-pll: Rename some variables in clkgen_c32_pll_setup()

Haoxiang Li posted 7 patches 3 weeks, 4 days ago
There is a newer version of this series
[PATCH 3/7] clk: st: clkgen-pll: Rename some variables in clkgen_c32_pll_setup()
Posted by Haoxiang Li 3 weeks, 4 days ago
In clkgen_c32_pll_setup(), `clk` is used for two distint variables' name.
This patch rename the later `clk` to `odf_clk`.
The rename is in preparation for cleaning up some memory leaks.

Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
---
 drivers/clk/st/clkgen-pll.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/st/clkgen-pll.c b/drivers/clk/st/clkgen-pll.c
index 0390f6834a0d..4ff9b35fe399 100644
--- a/drivers/clk/st/clkgen-pll.c
+++ b/drivers/clk/st/clkgen-pll.c
@@ -797,7 +797,7 @@ static void __init clkgen_c32_pll_setup(struct device_node *np,
 		goto err;
 
 	for (odf = 0; odf < num_odfs; odf++) {
-		struct clk *clk;
+		struct clk *odf_clk;
 		const char *clk_name;
 		unsigned long odf_flags = 0;
 
@@ -813,13 +813,13 @@ static void __init clkgen_c32_pll_setup(struct device_node *np,
 			of_clk_detect_critical(np, odf, &odf_flags);
 		}
 
-		clk = clkgen_odf_register(pll_name, pll_base, datac->data,
+		odf_clk = clkgen_odf_register(pll_name, pll_base, datac->data,
 				odf_flags, odf, &clkgena_c32_odf_lock,
 				clk_name);
-		if (IS_ERR(clk))
 			goto err;
+		if (IS_ERR(odf_clk))
 
-		clk_data->clks[odf] = clk;
+		clk_data->clks[odf] = odf_clk;
 	}
 
 	of_clk_add_provider(np, of_clk_src_onecell_get, clk_data);
-- 
2.25.1
Re: [PATCH 3/7] clk: st: clkgen-pll: Rename some variables in clkgen_c32_pll_setup()
Posted by Markus Elfring 3 weeks, 3 days ago
> In clkgen_c32_pll_setup(), `clk` is used for two distint variables' name.

                                                   distinct variable names?


> This patch rename …

See also once more:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.19-rc5#n94

Regards,
Markus
Re: [PATCH 3/7] clk: st: clkgen-pll: Rename some variables in clkgen_c32_pll_setup()
Posted by Brian Masney 3 weeks, 3 days ago
Hi Haoxiang,

On Fri, Jan 16, 2026 at 07:38:43PM +0800, Haoxiang Li wrote:
> In clkgen_c32_pll_setup(), `clk` is used for two distint variables' name.
> This patch rename the later `clk` to `odf_clk`.
> The rename is in preparation for cleaning up some memory leaks.
> 
> Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
> ---
>  drivers/clk/st/clkgen-pll.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/clk/st/clkgen-pll.c b/drivers/clk/st/clkgen-pll.c
> index 0390f6834a0d..4ff9b35fe399 100644
> --- a/drivers/clk/st/clkgen-pll.c
> +++ b/drivers/clk/st/clkgen-pll.c
> @@ -797,7 +797,7 @@ static void __init clkgen_c32_pll_setup(struct device_node *np,
>  		goto err;
>  
>  	for (odf = 0; odf < num_odfs; odf++) {
> -		struct clk *clk;
> +		struct clk *odf_clk;
>  		const char *clk_name;
>  		unsigned long odf_flags = 0;
>  
> @@ -813,13 +813,13 @@ static void __init clkgen_c32_pll_setup(struct device_node *np,
>  			of_clk_detect_critical(np, odf, &odf_flags);
>  		}
>  
> -		clk = clkgen_odf_register(pll_name, pll_base, datac->data,
> +		odf_clk = clkgen_odf_register(pll_name, pll_base, datac->data,
>  				odf_flags, odf, &clkgena_c32_odf_lock,
>  				clk_name);
> -		if (IS_ERR(clk))
>  			goto err;
> +		if (IS_ERR(odf_clk))

This if shouldn't have been moved below the goto.

Also for the subject:

> Subject: [PATCH 2/7] clk: st: clkgen-pll: Rename some variables in clkgen_c32_pll_setup()

I would use the specific variable name like this:

clk: st: clkgen-pll: Rename clk variable in clkgen_c32_pll_setup()

Brian

>  
> -		clk_data->clks[odf] = clk;
> +		clk_data->clks[odf] = odf_clk;
>  	}
>  
>  	of_clk_add_provider(np, of_clk_src_onecell_get, clk_data);
> -- 
> 2.25.1
>