Re: [PATCH] xtensa: time: Fix clk reference leak in calibrate_ccount()
From: Max Filippov
Date: Wed Sep 09 2026 - 12:40:19 EST
Hi,
On Tue, Sep 8, 2026 at 9:43 PM blaze <1466528493@xxxxxx> wrote:
> In calibrate_ccount(), of_clk_get() acquires a reference to the CPU clock,
> but clk_put() is never called to release it. The clock reference is used
> only to read the frequency via clk_get_rate(), then the function returns
> immediately, leaking the reference.
>
> Fix this by calling clk_put(clk) before returning.
>
> Fixes: a1f31a21e0c1 ("xtensa: add clocksource")
> Signed-off-by: blaze <1466528493@xxxxxx>
the handle "blaze <1466528493@xxxxxx>" doesn't look like a known identity,
as Documentation/process/submitting-patches.rst requires, and it's one of the
first appearances of this name in the LKML. Could you please re-submit using
something less anonymous?
> ---
> arch/xtensa/kernel/time.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c
> index 0000000..1111111 100644
> --- a/arch/xtensa/kernel/time.c
> +++ b/arch/xtensa/kernel/time.c
> @@ -152,6 +152,7 @@ static void __init calibrate_ccount(void)
> if (!IS_ERR(clk)) {
> ccount_freq = clk_get_rate(clk);
> + clk_put(clk);
> return;
> } else {
> pr_warn("%s: CPU input clock not found\n",
> --
> 2.43.0
>
The change itself looks good, thanks.
-- Max