From: Uwe Kleine-König Date: Wed, 7 Jul 2021 16:27:56 +0000 (+0200) Subject: pwm: tiehrpwm: Unprepare clock only after the PWM was unregistered X-Git-Tag: microblaze-v5.16~24^2~44 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=1a0c97b6460f30d8b164eaef07d77369e466dda3;p=linux-2.6-microblaze.git pwm: tiehrpwm: Unprepare clock only after the PWM was unregistered 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 ehrpwm_pwm_remove() a bit simpler and eventually allows to make pwmchip_remove() return void. Signed-off-by: Uwe Kleine-König Signed-off-by: Thierry Reding --- diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c index 17909fa53211..5b723a48c5f1 100644 --- a/drivers/pwm/pwm-tiehrpwm.c +++ b/drivers/pwm/pwm-tiehrpwm.c @@ -485,11 +485,13 @@ static int ehrpwm_pwm_remove(struct platform_device *pdev) { struct ehrpwm_pwm_chip *pc = platform_get_drvdata(pdev); + pwmchip_remove(&pc->chip); + clk_unprepare(pc->tbclk); pm_runtime_disable(&pdev->dev); - return pwmchip_remove(&pc->chip); + return 0; } #ifdef CONFIG_PM_SLEEP