All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Daniel Carter" <yass27106@gmail.com>
Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 4/4] soundwire: qcom: check clk_prepare_enable() return values
Date: Fri, 13 Nov 2026 21:19:40 +0000	[thread overview]
Message-ID: <sashiko-outbox-213708@kernel.org> (raw)
In-Reply-To: <cc928d726ea34f5cb37fa140ca791e58@gmail.com>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] soundwire: qcom: enable_irq() in swrm_runtime_resume() causes
  wake IRQ storm
- [Low] soundwire: qcom: missing Fixes trailers for clk_prepare_enable()
  check
- [Low] soundwire: qcom: qcom_swrm_irq_handler() returns IRQ_HANDLED on
  clk error
--

commit 5c5235a561fc40c30680eee11304261327eab6cc
Author: Daniel Carter <yass27106@gmail.com>

> soundwire: qcom: check clk_prepare_enable() return values
>
> 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>

[Severity: Low]
Since this fixes unchecked clk_prepare_enable() calls introduced in two
earlier commits, should this include Fixes: tags?

  Fixes: 02efb49aa805 ("soundwire: qcom: add support for SoundWire controller")
  Fixes: 74e79da9fd46 ("soundwire: qcom: add runtime pm support")

> diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
> index 0bdeb076a2e0e..ec510809766bb 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;

[Severity: Low]
Should this return IRQ_NONE instead of IRQ_HANDLED when
clk_prepare_enable() fails?  The interrupt status is neither read nor
cleared, and returning IRQ_HANDLED causes irq_thread_fn() to mark the
interrupt as handled, preventing the genirq spurious interrupt detector
from disabling a stuck line.

[ ... ]

> @@ -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;
> +	}

[Severity: Medium]
Can calling enable_irq(ctrl->wake_irq) here cause a level-high wake IRQ
storm when swrm_runtime_resume() is invoked from
qcom_swrm_wake_irq_handler()?

ctrl->wake_irq is registered with IRQF_TRIGGER_HIGH | IRQF_ONESHOT.  During
an in-band wakeup, the slave holds the line high until the bus exits clock
stop, and qcom_swrm_wake_irq_handler() synchronously runs
swrm_runtime_resume() via pm_runtime_get_sync():

drivers/soundwire/qcom.c:qcom_swrm_wake_irq_handler() {
	ret = pm_runtime_get_sync(ctrl->dev);
	if (ret < 0 && ret != -EACCES) {
		dev_err_ratelimited(ctrl->dev,
				    "pm_runtime_get_sync failed in %s, ret %d\n",
				    __func__, ret);
		pm_runtime_put_noidle(ctrl->dev);
		return ret;
	}

	if (ctrl->wake_irq > 0) {
		if (!irqd_irq_disabled(irq_get_irq_data(ctrl->wake_irq)))
			disable_irq_nosync(ctrl->wake_irq);
	}
    ...
}

When clk_prepare_enable() fails, enable_irq() unmasks ctrl->wake_irq at the
irqchip (even while the oneshot threaded handler is running), and
qcom_swrm_wake_irq_handler() returns early before its own
disable_irq_nosync(ctrl->wake_irq).  Because the bus never resumed to clear
the wakeup condition, the slave continues driving the level-high line and
ctrl->wake_irq immediately re-fires in a loop.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/1ce6d7664e48413d9a5a8b11a986f746@gmail.com?part=4

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

Thread overview: 24+ 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 13:43     ` sashiko-bot
2026-11-13 15:04     ` Mark Brown
2026-11-13 13:39   ` [PATCH 1/2] arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA sashiko-bot
2026-11-13 15:44   ` 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 20:47             ` sashiko-bot
2026-11-13 20:51           ` [PATCH v2 2/3] arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA sashiko-bot
2026-11-13 20:39         ` [PATCH v2 1/3] dt-bindings: qcom: document " sashiko-bot
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               ` [PATCH v3 4/4] soundwire: qcom: check clk_prepare_enable() return values Daniel Carter
2026-11-13 21:19                 ` sashiko-bot [this message]
2026-11-13 21:19               ` [PATCH v3 3/4] ASoC: qcom: lpass macro / soundwire: asynchronous probe with clock retry sashiko-bot
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=sashiko-outbox-213708@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=yass27106@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.