Skip to contentSkip to conversation

pwm: tiehrpwm: fix runtime pm imbalance at unbind

PATCH In review Johan Hovold 2 participants 3 messages Jul 20, 2017 – Aug 21, 2017 PWM

lore
Share & tools
lore
#0 lore raw

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")
---
 drivers/pwm/pwm-tiehrpwm.c | 1 -
 1 file changed, 1 deletion(-)
drivers/pwm/pwm-tiehrpwm.c +0 -1
index b5c6b0636893..6e51a075d1a7 100644
@@ -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
#1 lore raw

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.")
---
 drivers/pwm/pwm-tiehrpwm.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/pwm/pwm-tiehrpwm.c +6 -1
index 6e51a075d1a7..387eaf1bac85 100644
@@ -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
#2 lore raw
In reply to Johan Hovold
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")
---
 drivers/pwm/pwm-tiehrpwm.c | 1 -
 1 file changed, 1 deletion(-)

Both patches applied to for-4.14/drivers, thanks.

Thierry