pwm: tiehrpwm: fix runtime pm imbalance at unbind
PATCH 1/2 pwm: tiehrpwm: fix runtime pm imbalance at unbind
Remove unbalanced RPM put at driver unbind which resulted in a negative usage count.
Fixes 19891b20e7c2 ("pwm: pwm-tiehrpwm: PWM driver support for EHRPWM")
Signed-off-by Johan Hovold <[email protected]>
--- drivers/pwm/pwm-tiehrpwm.c | 1 - 1 file changed, 1 deletion(-)
drivers/pwm/pwm-tiehrpwm.c +0 -1
@@ -504,7 +504,6 @@ static int ehrpwm_pwm_remove(struct platform_device *pdev)clk_unprepare (pc->tbclk); -pm_runtime_put_sync (&pdev->dev);pm_runtime_disable (&pdev->dev);return pwmchip_remove (&pc->chip); }
Signature · 1 line
2.13.3
PATCH 2/2 pwm: tiehrpwm: fix clock imbalance in probe error path
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 <[email protected]>
--- drivers/pwm/pwm-tiehrpwm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/pwm/pwm-tiehrpwm.c +6 -1
@@ -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)
Signature · 1 line
2.13.3
Quoted 8 lines · Johan Hovold
Remove unbalanced RPM put at driver unbind which resulted in a negative usage count.
Fixes 19891b20e7c2 ("pwm: pwm-tiehrpwm: PWM driver support for EHRPWM")Signed-off-by Johan Hovold <[email protected]>--- drivers/pwm/pwm-tiehrpwm.c | 1 - 1 file changed, 1 deletion(-)
Both patches applied to for-4.14/drivers, thanks.
Thierry