pwm: tiehrpwm: fix clock imbalance in probe error path
authorJohan Hovold <johan@kernel.org>
Thu, 20 Jul 2017 10:48:17 +0000 (12:48 +0200)
committerThierry Reding <thierry.reding@gmail.com>
Mon, 21 Aug 2017 06:11:26 +0000 (08:11 +0200)
Make sure to unprepare the clock before returning on late probe errors.

Fixes: b388f15fd14c ("pwm: pwm-tiehrpwm: Use clk_enable/disable instead clk_prepare/unprepare.")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-tiehrpwm.c

index 6e51a075d1a769b85ccedeebe94b5e11d09406a3..387eaf1bac856230dae037ec8c3d78d0ccc7a91d 100644 (file)
@@ -489,13 +489,18 @@ static int ehrpwm_pwm_probe(struct platform_device *pdev)
        ret = pwmchip_add(&pc->chip);
        if (ret < 0) {
                dev_err(&pdev->dev, "pwmchip_add() failed: %d\n", ret);
-               return ret;
+               goto err_clk_unprepare;
        }
 
        pm_runtime_enable(&pdev->dev);
 
        platform_set_drvdata(pdev, pc);
        return 0;
+
+err_clk_unprepare:
+       clk_unprepare(pc->tbclk);
+
+       return ret;
 }
 
 static int ehrpwm_pwm_remove(struct platform_device *pdev)