From: sashiko-bot@kernel.org
To: "Mohammad Rafi Shaik" <mohammad.rafi.shaik@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH v3 5/7] ASoC: codec: pcm1681: Enable the PCM1681 supplies
Date: Fri, 09 Oct 2026 13:21:06 +0000 [thread overview]
Message-ID: <sashiko-outbox-165623@kernel.org> (raw)
In-Reply-To: <20261009-nord-asoc-driver-support-v3-v3-5-0c1897f21ccf@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] asoc: devres ordering bug leaves component active after remove disables clocks
--
commit 7a5eea3c05ab4c0d2ec17ff354d7cd0e31ecd47b
Author: Shawn Guo <shengchao.guo@oss.qualcomm.com>
Subject: ASoC: codec: pcm1681: Enable the PCM1681 supplies
This commit adds regulator support for the PCM1681 DAC's analog and digital
supplies. It uses devm_regulator_bulk_get_enable() during probe to ensure
power is enabled before touching clocks or regmap.
> diff --git a/sound/soc/codecs/pcm1681.c b/sound/soc/codecs/pcm1681.c
> index 3675b2236d663..6002da3a56669 100644
> --- a/sound/soc/codecs/pcm1681.c
> +++ b/sound/soc/codecs/pcm1681.c
[ ... ]
> @@ -347,6 +352,13 @@ static int pcm1681_i2c_probe(struct i2c_client *client)
> if (!priv)
> return -ENOMEM;
>
> + ret = devm_regulator_bulk_get_enable(dev,
> + ARRAY_SIZE(pcm1681_supply_names),
> + pcm1681_supply_names);
> + if (ret)
> + return dev_err_probe(dev, ret,
> + "Failed to enable supplies\n");
> +
[Severity: High]
Does adding this regulator to the devres stack interact poorly with the device
teardown sequence?
The probe function registers the component using
devm_snd_soc_register_component(), meaning it will be unregistered
automatically by devres after the driver's remove() callback completes.
However, in pcm1681_i2c_remove(), the driver explicitly tears down runtime
PM and forcefully disables the hardware clock before devres gets a chance
to unregister the component:
sound/soc/codecs/pcm1681.c:pcm1681_i2c_remove() {
...
pm_runtime_disable(dev);
/* Runtime PM may already have gated the clock */
if (!pm_runtime_status_suspended(dev))
clk_disable_unprepare(priv->sck);
...
}
This creates a window where the ASoC component is still fully registered and
active in ALSA, but its hardware clock is disabled and runtime PM is
permanently deactivated.
If ALSA or userspace accesses the component (e.g., reading or writing mixer
controls like pcm1681_put_deemph) during this window, the component will
attempt I2C register accesses without the required system clock or runtime PM
support. This can lead to kernel crashes, I2C bus hangs, or silent register
corruption.
While the current patch adds a devm_regulator action to the devres stack,
modifying the overall teardown sequence, this ordering window leaves the
component vulnerable during remove. Should the driver avoid devres for
component registration or reorder the manual cleanup to prevent this?
> priv->sck = devm_clk_get_optional(dev, "sck");
> if (IS_ERR(priv->sck))
> return dev_err_probe(dev, PTR_ERR(priv->sck),
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261009-nord-asoc-driver-support-v3-v3-0-0c1897f21ccf@oss.qualcomm.com?part=5
next prev parent reply other threads:[~2026-10-09 13:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-09 13:12 [PATCH v3 0/7] ASoC: qcom: Add Nord audio support Mohammad Rafi Shaik
2026-10-09 13:12 ` [PATCH v3 1/7] ASoC: dt-bindings: ti,pcm1681: Document the optional SCK clock Mohammad Rafi Shaik
2026-10-09 13:12 ` [PATCH v3 2/7] ASoC: codec: pcm1681: Add optional SCK clock and runtime PM support Mohammad Rafi Shaik
2026-10-09 13:23 ` sashiko-bot
2026-10-10 3:07 ` Wang, Sen
2026-10-09 13:12 ` [PATCH v3 3/7] ASoC: codec: pcm1681: Add TDM support Mohammad Rafi Shaik
2026-10-09 13:20 ` sashiko-bot
2026-10-10 3:12 ` Wang, Sen
2026-10-09 13:12 ` [PATCH v3 4/7] ASoC: dt-bindings: ti,pcm1681: Document the PCM1681 supplies Mohammad Rafi Shaik
2026-10-09 13:12 ` [PATCH v3 5/7] ASoC: codec: pcm1681: Enable " Mohammad Rafi Shaik
2026-10-09 13:21 ` sashiko-bot [this message]
2026-10-10 3:13 ` Wang, Sen
2026-10-09 13:12 ` [PATCH v3 6/7] ASoC: dt-bindings: qcom,sm8250: Add Nord sound card Mohammad Rafi Shaik
2026-10-09 13:12 ` [PATCH v3 7/7] ASoC: qcom: sc8280xp: Add Nord sound card support Mohammad Rafi Shaik
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-165623@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=mohammad.rafi.shaik@oss.qualcomm.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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