Skip to content

Commit 36579ac

Browse files
tititiou36lag-linaro
authored andcommitted
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: 3526403 ("mfd: qcom_rpm: Handle message RAM clock") Signed-off-by: Christophe JAILLET <[email protected]> Signed-off-by: Lee Jones <[email protected]> Link: https://lore.kernel.org/r/e39752476d02605b2be46cab7115f71255ce13a8.1668949256.git.christophe.jaillet@wanadoo.fr
1 parent f359c3e commit 36579ac

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/mfd/qcom_rpm.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ static int qcom_rpm_probe(struct platform_device *pdev)
547547
init_completion(&rpm->ack);
548548

549549
/* Enable message RAM clock */
550-
rpm->ramclk = devm_clk_get(&pdev->dev, "ram");
550+
rpm->ramclk = devm_clk_get_enabled(&pdev->dev, "ram");
551551
if (IS_ERR(rpm->ramclk)) {
552552
ret = PTR_ERR(rpm->ramclk);
553553
if (ret == -EPROBE_DEFER)
@@ -558,7 +558,6 @@ static int qcom_rpm_probe(struct platform_device *pdev)
558558
*/
559559
rpm->ramclk = NULL;
560560
}
561-
clk_prepare_enable(rpm->ramclk); /* Accepts NULL */
562561

563562
irq_ack = platform_get_irq_byname(pdev, "ack");
564563
if (irq_ack < 0)
@@ -681,7 +680,6 @@ static int qcom_rpm_remove(struct platform_device *pdev)
681680
struct qcom_rpm *rpm = dev_get_drvdata(&pdev->dev);
682681

683682
of_platform_depopulate(&pdev->dev);
684-
clk_disable_unprepare(rpm->ramclk);
685683

686684
return 0;
687685
}

0 commit comments

Comments
 (0)