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

The return value of pwmchip_remove doesn't need to be checked because
it returns zero anyhow and should be changed to return void eventually.

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

index 4a6e9ad..333f1b1 100644 (file)
@@ -248,13 +248,15 @@ static int hibvt_pwm_remove(struct platform_device *pdev)
 
        pwm_chip = platform_get_drvdata(pdev);
 
+       pwmchip_remove(&pwm_chip->chip);
+
        reset_control_assert(pwm_chip->rstc);
        msleep(30);
        reset_control_deassert(pwm_chip->rstc);
 
        clk_disable_unprepare(pwm_chip->clk);
 
-       return pwmchip_remove(&pwm_chip->chip);
+       return 0;
 }
 
 static const struct of_device_id hibvt_pwm_of_match[] = {