mtd: rawnand: nuvoton: fix clock cleanup on probe failure
Subsystems (3)
PATCH 1/1 mtd: rawnand: nuvoton: fix clock cleanup on probe failure
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.
--- drivers/mtd/nand/raw/nuvoton-ma35d1-nand-controller.c | 1 - 1 file changed, 1 deletion(-)
drivers/mtd/nand/raw/nuvoton-ma35d1-nand-controller.c +0 -1
@@ -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; }
Signature · 1 line
2.43.0
Quoted 11 lines · Guangshuo Li
ma35_nand_probe()gets and enables the NAND clock withdevm_clk_get_enabled(), but thema35_nand_chips_init()failure path also callsclk_disable()before returning.
devm_clk_get_enabled()registers a managed cleanup that callsclk_disable_unprepare()on probe failure and driver removal. Callingclk_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