Skip to content

Commit

Permalink
pwm: spear: Free resources only after pwmchip_remove()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Uwe Kleine-König authored and Thierry Reding committed May 25, 2021
1 parent b601a18 commit da0dea8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/pwm/pwm-spear.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {
Expand Down

0 comments on commit da0dea8

Please sign in to comment.