summaryrefslogtreecommitdiff
path: root/drivers/pwm/pwm-spear.c
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2021-04-28 11:05:25 +0200
committerThierry Reding <thierry.reding@gmail.com>2021-05-25 18:42:54 +0200
commitda0dea8912697f725d5f1386a38cb035222e7468 (patch)
treeed0e894642d3bf7fc6af73184e5c03922894392c /drivers/pwm/pwm-spear.c
parentb601a18f12383001e7a8da238de7ca1559ebc450 (diff)
pwm: spear: Free resources only after pwmchip_remove()
Before pwmchip_remove() returns the PWM is expected to be functional. So remove the pwmchip before disabling the clocks. The check for pwmchip_remove()'s return value is dropped as this function returns effectively always 0 and returning an error in a remove callback is useless anyhow (as the device core ignores it and drops devm allocated resources). 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-spear.c')
-rw-r--r--drivers/pwm/pwm-spear.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/pwm/pwm-spear.c b/drivers/pwm/pwm-spear.c
index 6879b49581b3..05a19e70d570 100644
--- a/drivers/pwm/pwm-spear.c
+++ b/drivers/pwm/pwm-spear.c
@@ -229,9 +229,12 @@ static int spear_pwm_remove(struct platform_device *pdev)
{
struct spear_pwm_chip *pc = platform_get_drvdata(pdev);
+ pwmchip_remove(&pc->chip);
+
/* clk was prepared in probe, hence unprepare it here */
clk_unprepare(pc->clk);
- return pwmchip_remove(&pc->chip);
+
+ return 0;
}
static const struct of_device_id spear_pwm_of_match[] = {