summaryrefslogtreecommitdiffstats
path: root/drivers/pwm/pwm-atmel-tcb.c
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2021-03-08 10:51:50 +0100
committerThierry Reding <thierry.reding@gmail.com>2021-03-22 12:06:45 +0100
commitc77e99f434c29d79505bd740cfead9648dfe0795 (patch)
treebb3f10d948da0d9eb72639390b30948a54fa80bd /drivers/pwm/pwm-atmel-tcb.c
parentpwm: atmel-tcb: Implement .apply callback (diff)
downloadlinux-c77e99f434c29d79505bd740cfead9648dfe0795.tar.xz
linux-c77e99f434c29d79505bd740cfead9648dfe0795.zip
pwm: atmel-tcb: Only free resources after pwm_chip_remove() returned
Otherwise the PWM stops working before the PWM core and its consumers are aware the device is going away. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'drivers/pwm/pwm-atmel-tcb.c')
-rw-r--r--drivers/pwm/pwm-atmel-tcb.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c
index 4d2253f3048c..8451d3e846be 100644
--- a/drivers/pwm/pwm-atmel-tcb.c
+++ b/drivers/pwm/pwm-atmel-tcb.c
@@ -507,14 +507,14 @@ static int atmel_tcb_pwm_remove(struct platform_device *pdev)
struct atmel_tcb_pwm_chip *tcbpwm = platform_get_drvdata(pdev);
int err;
- clk_disable_unprepare(tcbpwm->slow_clk);
- clk_put(tcbpwm->slow_clk);
- clk_put(tcbpwm->clk);
-
err = pwmchip_remove(&tcbpwm->chip);
if (err < 0)
return err;
+ clk_disable_unprepare(tcbpwm->slow_clk);
+ clk_put(tcbpwm->slow_clk);
+ clk_put(tcbpwm->clk);
+
return 0;
}