[PATCH v4 2/4] soundwire: qcom: Check clk_prepare_enable() return value
From: Lee Jones
Date: Fri Nov 27 2026 - 11:24:24 EST
qcom_swrm_probe(), qcom_swrm_irq_handler(), and swrm_runtime_resume()
ignore the return value of clk_prepare_enable(ctrl->hclk) and proceed
to access controller registers even when enabling the interface clock
fails.
Check the return value of clk_prepare_enable() in all three callers and
abort register access on failure.
Closes: https://sashiko.dev/#/bug/linux-f65cddc9-08ff-4531-9acf-76981d74d914
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
---
v3 => v4:
- Rebase onto soundwire/next preserving the multi-master dependent resume path and wake_irq error handling.
drivers/soundwire/qcom.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 336690217d68..44ef3beeb1e7 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -804,7 +804,9 @@ static irqreturn_t qcom_swrm_irq_handler(int irq, void *dev_id)
u32 i;
int devnum;
int ret = IRQ_HANDLED;
- clk_prepare_enable(ctrl->hclk);
+
+ if (clk_prepare_enable(ctrl->hclk))
+ return IRQ_NONE;
ctrl->reg_read(ctrl, ctrl->reg_layout[SWRM_REG_INTERRUPT_STATUS],
&intr_sts);
@@ -1890,7 +1892,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);
@@ -2090,13 +2094,15 @@ static int __maybe_unused swrm_runtime_resume(struct device *dev)
if (ctrl->mm_role == QCOM_SWRM_MM_DEPENDENT)
return clk_prepare_enable(ctrl->hclk);
+ ret = clk_prepare_enable(ctrl->hclk);
+ if (ret)
+ return ret;
+
if (ctrl->wake_irq > 0) {
if (!irqd_irq_disabled(irq_get_irq_data(ctrl->wake_irq)))
disable_irq_nosync(ctrl->wake_irq);
}
- clk_prepare_enable(ctrl->hclk);
-
if (ctrl->clock_stop_not_supported) {
reinit_completion(&ctrl->enumeration);
ctrl->reg_write(ctrl, SWRM_COMP_SW_RESET, 0x01);
--
2.56.1.839.g22a8290db9-goog