* [PATCH] rtc: stm32: fix clock leak on pinctrl probe failure
@ 2026-09-14 13:29 Cong Nguyen
2026-09-16 7:49 ` [Linux-stm32] " Antonio Borneo
0 siblings, 1 reply; 2+ messages in thread
From: Cong Nguyen @ 2026-09-14 13:29 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Maxime Coquelin, Alexandre Torgue, Linus Walleij, Valentin Caron,
linux-rtc, linux-stm32, linux-arm-kernel, linux-kernel
stm32_rtc_probe() enables rtc_ck/pclk early and unwinds them through
the err: label on every later failure -- except a failing
devm_pinctrl_register_and_init() or pinctrl_enable(), which both
return directly, leaking both clocks. -EPROBE_DEFER is a routine
outcome from pinctrl lookups during boot, so each deferred retry
leaks another reference.
Route both through the existing err: label, matching every other
post-enable failure path in this function.
Fixes: 16ad2bc09efb ("rtc: stm32: add pinctrl and pinmux interfaces")
Assisted-by: Claude:claude-opus-4
Signed-off-by: Cong Nguyen <congnt264@gmail.com>
---
drivers/rtc/rtc-stm32.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/rtc/rtc-stm32.c b/drivers/rtc/rtc-stm32.c
index d4ebf3eb54aa..e7a942f6c190 100644
--- a/drivers/rtc/rtc-stm32.c
+++ b/drivers/rtc/rtc-stm32.c
@@ -1175,12 +1175,16 @@ static int stm32_rtc_probe(struct platform_device *pdev)
stm32_rtc_clean_outs(rtc);
ret = devm_pinctrl_register_and_init(&pdev->dev, &stm32_rtc_pdesc, rtc, &pctl);
- if (ret)
- return dev_err_probe(&pdev->dev, ret, "pinctrl register failed");
+ if (ret) {
+ dev_err_probe(&pdev->dev, ret, "pinctrl register failed");
+ goto err;
+ }
ret = pinctrl_enable(pctl);
- if (ret)
- return dev_err_probe(&pdev->dev, ret, "pinctrl enable failed");
+ if (ret) {
+ dev_err_probe(&pdev->dev, ret, "pinctrl enable failed");
+ goto err;
+ }
/*
* If INITS flag is reset (calendar year field set to 0x00), calendar
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [Linux-stm32] [PATCH] rtc: stm32: fix clock leak on pinctrl probe failure
2026-09-14 13:29 [PATCH] rtc: stm32: fix clock leak on pinctrl probe failure Cong Nguyen
@ 2026-09-16 7:49 ` Antonio Borneo
0 siblings, 0 replies; 2+ messages in thread
From: Antonio Borneo @ 2026-09-16 7:49 UTC (permalink / raw)
To: Cong Nguyen, Alexandre Belloni
Cc: linux-rtc, Linus Walleij, linux-kernel, Maxime Coquelin,
linux-stm32, linux-arm-kernel
On Mon, 2026-09-14 at 20:29 +0700, Cong Nguyen wrote:
> stm32_rtc_probe() enables rtc_ck/pclk early and unwinds them through
> the err: label on every later failure -- except a failing
> devm_pinctrl_register_and_init() or pinctrl_enable(), which both
> return directly, leaking both clocks. -EPROBE_DEFER is a routine
> outcome from pinctrl lookups during boot, so each deferred retry
> leaks another reference.
>
> Route both through the existing err: label, matching every other
> post-enable failure path in this function.
>
> Fixes: 16ad2bc09efb ("rtc: stm32: add pinctrl and pinmux interfaces")
> Assisted-by: Claude:claude-opus-4
Shouldn't it be
Assisted-by: LLM
accordingly to commit 816d9992d9ed in latest
Documentation/process/coding-assistants.rst ?
> Signed-off-by: Cong Nguyen <congnt264@gmail.com>
> ---
Apart from the comment above,
Reviewed-by: Antonio Borneo <antonio.borneo@foss.st.com>
Thanks!
Antonio
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-16 7:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-14 13:29 [PATCH] rtc: stm32: fix clock leak on pinctrl probe failure Cong Nguyen
2026-09-16 7:49 ` [Linux-stm32] " Antonio Borneo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®