OSDN Git Service

pwm: bcm2835: Free resources only after pwmchip_remove()
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thu, 25 Mar 2021 08:29:31 +0000 (09:29 +0100)
committerThierry Reding <thierry.reding@gmail.com>
Fri, 9 Apr 2021 12:33:39 +0000 (14:33 +0200)
Before pwmchip_remove() returns the PWM is expected to be functional. So
remove the pwmchip before disabling the clock.

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

index e4b5467..fc240d5 100644 (file)
@@ -179,9 +179,11 @@ static int bcm2835_pwm_remove(struct platform_device *pdev)
 {
        struct bcm2835_pwm *pc = platform_get_drvdata(pdev);
 
+       pwmchip_remove(&pc->chip);
+
        clk_disable_unprepare(pc->clk);
 
-       return pwmchip_remove(&pc->chip);
+       return 0;
 }
 
 static const struct of_device_id bcm2835_pwm_of_match[] = {