Commit 36579aca authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Lee Jones

mfd: qcom_rpm: Fix an error handling path in qcom_rpm_probe()

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: 35264033 ("mfd: qcom_rpm: Handle message RAM clock")
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarLee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/e39752476d02605b2be46cab7115f71255ce13a8.1668949256.git.christophe.jaillet@wanadoo.fr
parent f359c3e5
...@@ -547,7 +547,7 @@ static int qcom_rpm_probe(struct platform_device *pdev) ...@@ -547,7 +547,7 @@ static int qcom_rpm_probe(struct platform_device *pdev)
init_completion(&rpm->ack); init_completion(&rpm->ack);
/* Enable message RAM clock */ /* 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)) { if (IS_ERR(rpm->ramclk)) {
ret = PTR_ERR(rpm->ramclk); ret = PTR_ERR(rpm->ramclk);
if (ret == -EPROBE_DEFER) if (ret == -EPROBE_DEFER)
...@@ -558,7 +558,6 @@ static int qcom_rpm_probe(struct platform_device *pdev) ...@@ -558,7 +558,6 @@ static int qcom_rpm_probe(struct platform_device *pdev)
*/ */
rpm->ramclk = NULL; rpm->ramclk = NULL;
} }
clk_prepare_enable(rpm->ramclk); /* Accepts NULL */
irq_ack = platform_get_irq_byname(pdev, "ack"); irq_ack = platform_get_irq_byname(pdev, "ack");
if (irq_ack < 0) if (irq_ack < 0)
...@@ -681,7 +680,6 @@ static int qcom_rpm_remove(struct platform_device *pdev) ...@@ -681,7 +680,6 @@ static int qcom_rpm_remove(struct platform_device *pdev)
struct qcom_rpm *rpm = dev_get_drvdata(&pdev->dev); struct qcom_rpm *rpm = dev_get_drvdata(&pdev->dev);
of_platform_depopulate(&pdev->dev); of_platform_depopulate(&pdev->dev);
clk_disable_unprepare(rpm->ramclk);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment