Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1692786

[PATCH 2/2] pwm: tiehrpwm: fix clock imbalance in probe error path

From Johan Hovold <johan@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 2/2] pwm: tiehrpwm: fix clock imbalance in probe error path
Date 2017-07-20 12:50 +0200
Message-ID <u5hbQ-67w-11@gated-at.bofh.it> (permalink)
References <u5hbQ-67w-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 drivers/pwm/pwm-tiehrpwm.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c
index 6e51a075d1a7..387eaf1bac85 100644
--- a/drivers/pwm/pwm-tiehrpwm.c
+++ b/drivers/pwm/pwm-tiehrpwm.c
@@ -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)
-- 
2.13.3

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] pwm: tiehrpwm: fix runtime pm imbalance at unbind Johan Hovold <johan@kernel.org> - 2017-07-20 12:50 +0200
  [PATCH 2/2] pwm: tiehrpwm: fix clock imbalance in probe error path Johan Hovold <johan@kernel.org> - 2017-07-20 12:50 +0200

csiph-web