* [PATCH] mtd: rawnand: nuvoton: fix clock cleanup on probe failure
@ 2026-09-15 16:45 Guangshuo Li
2026-09-25 13:35 ` Miquel Raynal
0 siblings, 1 reply; 2+ messages in thread
From: Guangshuo Li @ 2026-09-15 16:45 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Jacky Huang, Shan-Chun Hung, Guangshuo Li, Hui-Ping Chen,
linux-mtd, linux-kernel, linux-arm-kernel
Cc: stable
ma35_nand_probe() gets and enables the NAND clock with
devm_clk_get_enabled(), but the ma35_nand_chips_init() failure path
also calls clk_disable() before returning.
devm_clk_get_enabled() registers a managed cleanup that calls
clk_disable_unprepare() on probe failure and driver removal. Calling
clk_disable() explicitly first drops the clock enable count, so the
managed cleanup attempts to disable the clock again and triggers the
clock framework warning for an already disabled clock.
Remove the redundant clk_disable() and let the managed clock cleanup
handle the clock state.
This issue was found by manual code inspection.
Fixes: 5abb5d414d55 ("mtd: rawnand: nuvoton: add new driver for the Nuvoton MA35 SoC")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
drivers/mtd/nand/raw/nuvoton-ma35d1-nand-controller.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/mtd/nand/raw/nuvoton-ma35d1-nand-controller.c b/drivers/mtd/nand/raw/nuvoton-ma35d1-nand-controller.c
index 1a285cd8fad6..f659d3a6b9ef 100644
--- a/drivers/mtd/nand/raw/nuvoton-ma35d1-nand-controller.c
+++ b/drivers/mtd/nand/raw/nuvoton-ma35d1-nand-controller.c
@@ -993,7 +993,6 @@ static int ma35_nand_probe(struct platform_device *pdev)
ret = ma35_nand_chips_init(&pdev->dev, nand);
if (ret) {
dev_err(&pdev->dev, "failed to init NAND chips\n");
- clk_disable(nand->clk);
return ret;
}
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mtd: rawnand: nuvoton: fix clock cleanup on probe failure
2026-09-15 16:45 [PATCH] mtd: rawnand: nuvoton: fix clock cleanup on probe failure Guangshuo Li
@ 2026-09-25 13:35 ` Miquel Raynal
0 siblings, 0 replies; 2+ messages in thread
From: Miquel Raynal @ 2026-09-25 13:35 UTC (permalink / raw)
To: Richard Weinberger, Vignesh Raghavendra, Jacky Huang,
Shan-Chun Hung, Hui-Ping Chen, linux-mtd, linux-kernel,
linux-arm-kernel, Guangshuo Li
Cc: stable
On Wed, 16 Sep 2026 00:45:37 +0800, Guangshuo Li wrote:
> ma35_nand_probe() gets and enables the NAND clock with
> devm_clk_get_enabled(), but the ma35_nand_chips_init() failure path
> also calls clk_disable() before returning.
>
> devm_clk_get_enabled() registers a managed cleanup that calls
> clk_disable_unprepare() on probe failure and driver removal. Calling
> clk_disable() explicitly first drops the clock enable count, so the
> managed cleanup attempts to disable the clock again and triggers the
> clock framework warning for an already disabled clock.
>
> [...]
Applied to nand/next, thanks!
[1/1] mtd: rawnand: nuvoton: fix clock cleanup on probe failure
commit: 8a485a40f45a19c5fcafb5cbee7387c2762af7c4
Patche(s) should be available on mtd/linux.git and will be
part of the next PR (provided that no robot complains by then).
Kind regards,
Miquèl
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-25 13:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-15 16:45 [PATCH] mtd: rawnand: nuvoton: fix clock cleanup on probe failure Guangshuo Li
2026-09-25 13:35 ` Miquel Raynal
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®