Re: [PATCH] clocksource/drivers/fttmr010: Fix clk reference leak in error paths

From: Linus Walleij

Date: Wed Sep 16 2026 - 15:21:06 EST


On Tue, Sep 15, 2026 at 6:55 AM Wentao Liang <vulab@xxxxxxxxxxx> wrote:

> fttmr010_common_init() obtains the PCLK reference with
> of_clk_get_by_name() but never calls clk_put(). If clk_prepare_enable()
> fails the reference is leaked directly, and every error path that jumps
> to out_disable_clock only calls clk_disable_unprepare(), which releases
> the prepare/enable state but not the reference obtained from
> of_clk_get_by_name().
>
> Add clk_put() to the clk_prepare_enable() failure path and to the
> out_disable_clock label so the clock reference is no longer leaked. The
> success path keeps PCLK enabled for the lifetime of the timer and is
> left untouched.
>
> Fixes: dd98442e17a6 ("clocksource/drivers/fttmr010: Drop Gemini specifics")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>

Reviewed-by: Linus Walleij <linusw@xxxxxxxxxx>

Yours,
Linus Walleij