Subject: Re: [PATCH] clk: moxart: fix refcount leak

From: Brian Masney <[email-masked]>
Date: Wed, 20 May 2026 18:29:20 -0400

Hi Alexander,

On Wed, May 20, 2026 at 07:55:50PM +0200, Alexander A. Klimov wrote:
> Every value returned from of_clk_get() is supposed to be cleaned up
> via clk_put() once not needed anymore.
> The values here are used only for error checking,
> but weren't cleaned up until now.
> 
> Fixes: c7bb4fc16ead ("clk: add MOXA ART SoCs clock driver")
> Signed-off-by: Alexander A. Klimov <[email-masked]>
> ---
>  drivers/clk/clk-moxart.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/clk/clk-moxart.c b/drivers/clk/clk-moxart.c
> index 3786a0153ad1..7e191b1481bb 100644
> --- a/drivers/clk/clk-moxart.c
> +++ b/drivers/clk/clk-moxart.c
> @@ -39,6 +39,7 @@ static void __init moxart_of_pll_clk_init(struct device_node *node)
>  		pr_err("%pOF: of_clk_get failed\n", node);
>  		return;
>  	}
> +	clk_put(ref_clk);
>  
>  	hw = clk_hw_register_fixed_factor(NULL, name, parent_name, 0, mul, 1);
>  	if (IS_ERR(hw)) {
> @@ -83,6 +84,7 @@ static void __init moxart_of_apb_clk_init(struct device_node *node)
>  		pr_err("%pOF: of_clk_get failed\n", node);
>  		return;
>  	}
> +	clk_put(pll_clk);

So this immediately drops the reference to the clk after of_clk_get() is
called. Can we just remove these two of_clk_get() calls since they don't
appear to be used?

Brian