Re: [PATCH] rtc: ftrtc010: fix clock resource leak on probe failure
From: Linus Walleij
Date: Mon Sep 14 2026 - 04:35:49 EST
On Thu, Aug 27, 2026 at 3:58 AM Liu Dalin <liudalin@xxxxxxxxxxxxxxx> wrote:
> When devm_rtc_register_device() fails, ftrtc010_rtc_probe() returns
> the error directly without releasing clocks obtained via
> clk_prepare_enable(). This leaks both extclk and pclk resources,
> which may prevent subsequent probe attempts or module removal.
>
> Capture the return value and jump to the error handling path to
> properly release clocks via clk_disable_unprepare().
>
> Fixes smatch warnings:
> - drivers/rtc/rtc-ftrtc010.c:189 ftrtc010_rtc_probe() warn:
> 'rtc->extclk' from clk_prepare_enable() not released on lines: 183.
> - drivers/rtc/rtc-ftrtc010.c:189 ftrtc010_rtc_probe() warn:
> 'rtc->pclk' from clk_prepare_enable() not released on lines: 183.
>
> Fixes: fdcfd854333b ("rtc: rework rtc_register_device() resource management")
> Assisted-by: smatch:2.0 [static analysis]
> Signed-off-by: Liu Dalin <liudalin@xxxxxxxxxxxxxxx>
Reviewed-by: Linus Walleij <linusw@xxxxxxxxxx>
Yours,
Linus Walleij