Re: [PATCH v2] rtc: stm32: fix clock leak on pinctrl probe failure
From: Linus Walleij
Date: Wed Sep 30 2026 - 09:53:13 EST
On Fri, Sep 18, 2026 at 11:59 AM Cong Nguyen <congnt264@xxxxxxxxx> wrote:
> A failing devm_pinctrl_register_and_init() or pinctrl_enable() in
> stm32_rtc_probe() returns directly instead of going through err:,
> leaking rtc_ck/pclk -- and since -EPROBE_DEFER is routine here, each
> deferred retry leaks another.
>
> Route both through err:, and move the pinctrl setup earlier (right
> after stm32_rtc_init(), before the RTC device/IRQ are registered) so
> disabling the clocks there doesn't race a still-live IRQ.
>
> Fixes: 16ad2bc09efb ("rtc: stm32: add pinctrl and pinmux interfaces")
> Reported-by: Sashiko AI review <sashiko-bot@xxxxxxxxxx>
> Link: https://lore.kernel.org/r/20260914135401.373D91F000FF@xxxxxxxxxxxxxxx
> Assisted-by: LLM
> Signed-off-by: Cong Nguyen <congnt264@xxxxxxxxx>
Reviewed-by: Linus Walleij <linusw@xxxxxxxxxx>
Yours,
Linus Walleij