From: sashiko-bot@kernel.org
To: "Alexey Charkov" <alchark@flipper.net>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 2/2] ASoC: codecs: nau8822: add support for supply regulators
Date: Mon, 25 May 2026 09:51:10 +0000 [thread overview]
Message-ID: <20260525095110.A5DFD1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260525-nau8822-reg-v2-2-7d37ae393e46@flipper.net>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Manually disabling regulators in the I2C `remove` callback breaks the LIFO teardown order, causing I2C operations to fail during `devm` component teardown.
- [Medium] Unconditional regulator disable in the `remove` callback can cause an unbalanced disable if the device is removed following a resume failure.
--
commit 9b4fbe6b13298617ee870787131ce69e29d799b3
Author: Alexey Charkov <alchark@flipper.net>
ASoC: codecs: nau8822: add support for supply regulators
This commit adds support for the four power supply pins on the NAU8822
codec by requesting and enabling them at init time. It also adds a brief
delay after power up to allow the device to stabilize before register access.
> diff --git a/sound/soc/codecs/nau8822.c b/sound/soc/codecs/nau8822.c
> --- a/sound/soc/codecs/nau8822.c
> +++ b/sound/soc/codecs/nau8822.c
[ ... ]
> ret = devm_snd_soc_register_component(dev, &soc_component_dev_nau8822,
> &nau8822_dai, 1);
> if (ret != 0) {
> dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret);
> - return ret;
> + goto err_reg;
> }
>
> return 0;
> +
> +err_reg:
> + regulator_bulk_disable(NAU8822_NUM_SUPPLIES, nau8822->supplies);
> + return ret;
> +}
> +
> +static void nau8822_i2c_remove(struct i2c_client *i2c)
> +{
> + struct nau8822 *nau8822 = i2c_get_clientdata(i2c);
> +
> + regulator_bulk_disable(NAU8822_NUM_SUPPLIES, nau8822->supplies);
[Severity: High]
Can this manual regulator disable cause I2C bus errors during teardown?
The ASoC component is registered with devm_snd_soc_register_component(),
which means the subsystem will unregister the component during the devres
cleanup phase. This happens after nau8822_i2c_remove() has already
returned.
Because the regulators are disabled here, the hardware will be unpowered
while the ASoC component is still active. During devres cleanup, the
subsystem will call snd_soc_dapm_shutdown() and transition the bias level
to SND_SOC_BIAS_OFF.
Will the resulting I2C register writes to the unpowered codec fail or
time out, potentially stalling the driver unbind?
[Severity: Medium]
Could this unconditional regulator disable also result in an unbalanced
disable warning?
If the system resumes but nau8822_resume() fails to re-enable the
regulators, they will remain in the disabled state set during
nau8822_suspend().
If the driver is later unbound, this call will execute again. Will this
attempt to drop the regulator reference count below zero and trigger a
kernel warning?
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260525-nau8822-reg-v2-0-7d37ae393e46@flipper.net?part=2
next prev parent reply other threads:[~2026-05-25 9:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-25 9:20 [PATCH v2 0/2] ASoC: nau8822: add support for supply regulators Alexey Charkov
2026-05-25 9:20 ` [PATCH v2 1/2] ASoC: dt-bindings: nau8822: Add " Alexey Charkov
2026-05-25 9:29 ` sashiko-bot
2026-05-25 9:53 ` Alexey Charkov
2026-05-25 9:20 ` [PATCH v2 2/2] ASoC: codecs: nau8822: add support for " Alexey Charkov
2026-05-25 9:51 ` sashiko-bot [this message]
2026-05-25 10:29 ` Alexey Charkov
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=20260525095110.A5DFD1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alchark@flipper.net \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--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