Skip to content

Commit

Permalink
mfd: qcom_rpm: Fix an error handling path in qcom_rpm_probe()
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tititiou36 authored and lag-linaro committed Dec 8, 2022
1 parent f359c3e commit 36579ac
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/mfd/qcom_rpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 36579ac

Please sign in to comment.