diff mbox series

[v2,1/1] Soundwire: fix the return value checks of clk_prepare_enable()

Message ID 20230722132419.37197-1-ruc_gongyuanjun@163.com
State New
Headers show
Series [v2,1/1] Soundwire: fix the return value checks of clk_prepare_enable() | expand

Commit Message

Yuanjun Gong July 22, 2023, 1:24 p.m. UTC
in qcom_swrm_probe() and swrm_runtime_resume(), the return value
of function clk_prepare_enable() should be checked, since it may
 fail.

Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
---
 drivers/soundwire/qcom.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 7970fdb27ba0..cf1e13a35023 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -1555,7 +1555,9 @@  static int qcom_swrm_probe(struct platform_device *pdev)
 		goto err_init;
 	}
 
-	clk_prepare_enable(ctrl->hclk);
+	ret = clk_prepare_enable(ctrl->hclk);
+	if (ret)
+		goto err_init;
 
 	ctrl->dev = dev;
 	dev_set_drvdata(&pdev->dev, ctrl);
@@ -1673,7 +1675,9 @@  static int __maybe_unused swrm_runtime_resume(struct device *dev)
 			disable_irq_nosync(ctrl->wake_irq);
 	}
 
-	clk_prepare_enable(ctrl->hclk);
+	ret = clk_prepare_enable(ctrl->hclk);
+	if (ret)
+		return ret;
 
 	if (ctrl->clock_stop_not_supported) {
 		reinit_completion(&ctrl->enumeration);