drivers/rtc/rtc-stm32.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
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
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
© 2016 - 2026 Red Hat, Inc.