pwm: rockchip: Unprepare clocks only after the PWM was unregistered
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 7 Jul 2021 16:27:55 +0000 (18:27 +0200)
committerThierry Reding <thierry.reding@gmail.com>
Thu, 2 Sep 2021 19:38:38 +0000 (21:38 +0200)
The driver is supposed to stay functional until pwmchip_remove()
returns. So disable clocks only after that.

pwmchip_remove() always returns 0, so the return code can be ignored
which keeps rockchip_pwm_remove() a bit simpler and allows to eventually
make pwmchip_remove() return void.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-rockchip.c

index 8fcef29948d779c38bf2812ef52f2b2871062f3d..f3647b3171522ace7cfb1e82acbd650e68e5431d 100644 (file)
@@ -384,10 +384,12 @@ static int rockchip_pwm_remove(struct platform_device *pdev)
 {
        struct rockchip_pwm_chip *pc = platform_get_drvdata(pdev);
 
+       pwmchip_remove(&pc->chip);
+
        clk_unprepare(pc->pclk);
        clk_unprepare(pc->clk);
 
-       return pwmchip_remove(&pc->chip);
+       return 0;
 }
 
 static struct platform_driver rockchip_pwm_driver = {