[PATCH v3 4/4] soundwire: qcom: check clk_prepare_enable() return values

From: Daniel Carter

Date: Fri Nov 13 2026 - 16:03:27 EST


clk_prepare_enable() can fail; unchecked, the driver proceeds to
touch registers with the interface clock off, which aborts on arm64.
Check the return value in the interrupt handler, in probe and in the
runtime resume path, re-enabling the wake IRQ on the resume error
path.

Signed-off-by: Daniel Carter <yass27106@xxxxxxxxx>
---
drivers/soundwire/qcom.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 473449dbdfa..c44bcd0f0cf 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -799,7 +799,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_HANDLED;

ctrl->reg_read(ctrl, ctrl->reg_layout[SWRM_REG_INTERRUPT_STATUS],
&intr_sts);
@@ -1696,7 +1698,11 @@ 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) {
+ dev_err(dev, "unable to enable iface clock\n");
+ goto err_init;
+ }

ctrl->dev = dev;
dev_set_drvdata(&pdev->dev, ctrl);
@@ -1821,7 +1827,14 @@ 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) {
+ if (ctrl->wake_irq > 0) {
+ if (irqd_irq_disabled(irq_get_irq_data(ctrl->wake_irq)))
+ enable_irq(ctrl->wake_irq);
+ }
+ return ret;
+ }

if (ctrl->clock_stop_not_supported) {
reinit_completion(&ctrl->enumeration);
--
2.55.0