mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Carter <yass27106@gmail.com>
To: krzk@kernel.org, andersson@kernel.org, broonie@kernel.org,
	srini@kernel.org, konradybcio@kernel.org
Cc: robh@kernel.org, conor+dt@kernel.org, vkoul@kernel.org,
	tiwai@suse.com, perex@perex.cz, lgirdwood@gmail.com,
	pierre-louis.bossart@linux.dev, yung-chuan.liao@linux.intel.com,
	abelvesa@kernel.org, linux-arm-msm@vger.kernel.org,
	linux-sound@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, yass27106@gmail.com
Subject: [PATCH v3 4/4] soundwire: qcom: check clk_prepare_enable() return values
Date: Fri, 13 Nov 2026 13:02:58 -0800 (PST)	[thread overview]
Message-ID: <cc928d726ea34f5cb37fa140ca791e58@gmail.com> (raw)
In-Reply-To: <4aaa766cace2455ab6c75ab801df357f@gmail.com>

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@gmail.com>
---
 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

  reply	other threads:[~2026-11-13 21:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 13:24 [PATCH 0/2] qcom: add Asus Vivobook 16 X1607QA DT + LPASS audio clock retry yass27106
2026-11-13 13:24 ` [PATCH 1/2] arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA yass27106
2026-11-13 13:24   ` [PATCH 2/2] ASoC: qcom: lpass macro / soundwire: retry deferred clock acquisition yass27106
2026-11-13 15:04     ` Mark Brown
2026-11-13 15:44   ` [PATCH 1/2] arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA Krzysztof Kozlowski
2026-11-13 20:33     ` [PATCH 1/2] arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA — v2 series Daniel Carter
2026-11-13 20:33       ` [PATCH v2 1/3] dt-bindings: qcom: document Asus Vivobook 16 X1607QA Daniel Carter
2026-11-13 20:33         ` [PATCH v2 2/3] arm64: dts: qcom: add device tree for " Daniel Carter
2026-11-13 20:33           ` [PATCH v2 3/3] ASoC: qcom: lpass macro / soundwire: retry deferred clock acquisition Daniel Carter
2026-11-13 21:02       ` [PATCH v2 1/3] arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA - v3 series Daniel Carter
2026-11-13 21:02         ` [PATCH v3 1/4] dt-bindings: qcom: document Asus Vivobook 16 X1607QA Daniel Carter
2026-11-13 21:02           ` [PATCH v3 2/4] arm64: dts: qcom: add device tree for " Daniel Carter
2026-11-13 21:02             ` [PATCH v3 3/4] ASoC: qcom: lpass macro / soundwire: asynchronous probe with clock retry Daniel Carter
2026-11-13 21:02               ` Daniel Carter [this message]
2026-11-13 21:06           ` [PATCH v3 1/4] dt-bindings: qcom: document Asus Vivobook 16 X1607QA Mark Brown
2026-11-13 21:17             ` Daniel Carter
2026-11-13 21:29               ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cc928d726ea34f5cb37fa140ca791e58@gmail.com \
    --to=yass27106@gmail.com \
    --cc=abelvesa@kernel.org \
    --cc=andersson@kernel.org \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=konradybcio@kernel.org \
    --cc=krzk@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=robh@kernel.org \
    --cc=srini@kernel.org \
    --cc=tiwai@suse.com \
    --cc=vkoul@kernel.org \
    --cc=yung-chuan.liao@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®