From: Daniel Carter <yass27106@gmail.com>
To: vkoul@kernel.org
Cc: srinivas.kandagatla@oss.qualcomm.com, andersson@kernel.org,
linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, yass27106@gmail.com
Subject: [PATCH v6] soundwire: qcom: check clk_prepare_enable() return values
Date: Tue, 24 Nov 2026 09:05:21 -0800 (PST) [thread overview]
Message-ID: <e5fda000d0dc4f168120c8ec91a752d5@gmail.com> (raw)
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 (returning IRQ_NONE,
as the interrupt status is not read or cleared on that path), in
probe, and in the runtime resume path (returning the error without
unmasking the level-high wake IRQ, which would storm while the slave
keeps driving the line).
Fixes: 02efb49aa805 ("soundwire: qcom: add support for SoundWire controller")
Fixes: 74e79da9fd46 ("soundwire: qcom: add runtime pm support")
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Carter <yass27106@gmail.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
---
Rebased on soundwire fixes (sdw/fixes) as requested; the runtime-resume hunk
now sits on top of "soundwire: qcom: disable the interrupt before gating
the clock". No functional change.
drivers/soundwire/qcom.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 147e55b7a60..ca312c18979 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -778,7 +778,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);
@@ -1675,7 +1677,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);
@@ -1800,7 +1806,10 @@ 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;
+
enable_irq(ctrl->irq);
if (ctrl->clock_stop_not_supported) {
--
2.55.0
reply other threads:[~2026-11-24 17:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=e5fda000d0dc4f168120c8ec91a752d5@gmail.com \
--to=yass27106@gmail.com \
--cc=andersson@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=srinivas.kandagatla@oss.qualcomm.com \
--cc=vkoul@kernel.org \
/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®