kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mfd: qcom_rpm: Fix an error handling path in qcom_rpm_probe()
@ 2022-11-20 13:01 Christophe JAILLET
  2022-11-20 13:01 ` [PATCH 2/2] mfd: qcom_rpm: Use devm_of_platform_populate() to simplify code Christophe JAILLET
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Christophe JAILLET @ 2022-11-20 13:01 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Lee Jones,
	Linus Walleij
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, Lee Jones,
	linux-arm-msm

If an error occurs after the clk_prepare_enable() call, a corresponding
clk_disable_unprepare() should be called.

Simplify code and switch to devm_clk_get_enabled() to fix it.

Fixes: 3526403353c2 ("mfd: qcom_rpm: Handle message RAM clock")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
This changes the order of the clean-ups if the .remove() function is called
but it looks fine to me.
---
 drivers/mfd/qcom_rpm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mfd/qcom_rpm.c b/drivers/mfd/qcom_rpm.c
index 71bc34b74bc9..ea5eb94427c4 100644
--- a/drivers/mfd/qcom_rpm.c
+++ b/drivers/mfd/qcom_rpm.c
@@ -547,7 +547,7 @@ static int qcom_rpm_probe(struct platform_device *pdev)
 	init_completion(&rpm->ack);
 
 	/* Enable message RAM clock */
-	rpm->ramclk = devm_clk_get(&pdev->dev, "ram");
+	rpm->ramclk = devm_clk_get_enabled(&pdev->dev, "ram");
 	if (IS_ERR(rpm->ramclk)) {
 		ret = PTR_ERR(rpm->ramclk);
 		if (ret == -EPROBE_DEFER)
@@ -558,7 +558,6 @@ static int qcom_rpm_probe(struct platform_device *pdev)
 		 */
 		rpm->ramclk = NULL;
 	}
-	clk_prepare_enable(rpm->ramclk); /* Accepts NULL */
 
 	irq_ack = platform_get_irq_byname(pdev, "ack");
 	if (irq_ack < 0)
@@ -681,7 +680,6 @@ static int qcom_rpm_remove(struct platform_device *pdev)
 	struct qcom_rpm *rpm = dev_get_drvdata(&pdev->dev);
 
 	of_platform_depopulate(&pdev->dev);
-	clk_disable_unprepare(rpm->ramclk);
 
 	return 0;
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-12-08 18:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-20 13:01 [PATCH 1/2] mfd: qcom_rpm: Fix an error handling path in qcom_rpm_probe() Christophe JAILLET
2022-11-20 13:01 ` [PATCH 2/2] mfd: qcom_rpm: Use devm_of_platform_populate() to simplify code Christophe JAILLET
2022-12-08 12:41   ` Lee Jones
2022-11-20 17:05 ` [PATCH 1/2] mfd: qcom_rpm: Fix an error handling path in qcom_rpm_probe() Christophe JAILLET
2022-11-20 17:19 ` Christophe JAILLET
2022-11-20 17:19 ` [PATCH] cpufreq: tegra186: Use flexible array to simplify memory allocation Christophe JAILLET
2022-12-01  9:20   ` Viresh Kumar
2022-12-08 12:30 ` [PATCH 1/2] mfd: qcom_rpm: Fix an error handling path in qcom_rpm_probe() Lee Jones
2022-12-08 18:31   ` Christophe JAILLET
2022-12-08 12:41 ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).