mtd: st_spi_fsm: Disable clock only after device was unregistered
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tue, 7 Jun 2022 15:24:57 +0000 (17:24 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Thu, 9 Jun 2022 13:06:36 +0000 (15:06 +0200)
Until mtd_device_unregister() returns the device is expected to be
operational. So only disable the clock after the mtd is unregistered.

Fixes: 1fefc8ecb834 ("mtd: st_spi_fsm: add missing clk_disable_unprepare() in stfsm_remove()")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20220607152458.232847-4-u.kleine-koenig@pengutronix.de
drivers/mtd/devices/st_spi_fsm.c

index a5a4b612480c17cb1bd666b6cfd3a5fbd9940060..9f6d4dd8bade330eb42d114f84fdc528972bfbff 100644 (file)
@@ -2128,10 +2128,10 @@ static int stfsm_remove(struct platform_device *pdev)
 {
        struct stfsm *fsm = platform_get_drvdata(pdev);
 
-       clk_disable_unprepare(fsm->clk);
-
        WARN_ON(mtd_device_unregister(&fsm->mtd));
 
+       clk_disable_unprepare(fsm->clk);
+
        return 0;
 }