From: sashiko-bot@kernel.org
To: "Hongyang Zhao" <hongyang.zhao@thundersoft.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 2/2] ASoC: codecs: es8316: Add regulator support
Date: Thu, 23 Jul 2026 08:51:23 +0000 [thread overview]
Message-ID: <20260723085123.F30FF1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260723-es8316-regulator-next-20260722-v1-2-721f757879a0@thundersoft.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
New issues:
- [High] The regmap lacks cache-only protection while regulators are disabled, allowing physical I2C access to an unpowered device.
- [High] Regmap cache becomes permanently out-of-sync with hardware after component unbind/rebind due to newly added unhandled power loss.
Pre-existing issues:
- [High] Unchecked return value of regmap_read() leads to usage of an uninitialized stack variable in the IRQ handler.
--
--- Patch [2]: [PATCH 2/2] ASoC: codecs: es8316: Add regulator support ---
commit 8810711bae01652cebd6d01e2ef62b85b877ad30
Author: Hongyang Zhao <hongyang.zhao@thundersoft.com>
ASoC: codecs: es8316: Add regulator support
ES8316 has separate AVDD, CPVDD, DVDD and PVDD supply inputs. Request the
supplies during I2C probe. Enable them before enabling MCLK and accessing
the device registers, and disable them on probe failure and component
removal.
> diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c
> index 3abe77423f29b..904056b2569a5 100644
> --- a/sound/soc/codecs/es8316.c
> +++ b/sound/soc/codecs/es8316.c
[ ... ]
> @@ -767,10 +778,16 @@ static int es8316_probe(struct snd_soc_component *component)
> if (!es8316->mclk)
> dev_warn(component->dev, "assuming static mclk\n");
>
> + ret = regulator_bulk_enable(ES8316_NUM_SUPPLIES, es8316->supplies);
> + if (ret) {
> + dev_err(component->dev, "unable to enable supplies\n");
> + return ret;
> + }
> +
[Severity: High]
Does this leave the regmap cache permanently out-of-sync with the hardware
after a component unbind and rebind?
When the component is unbound in es8316_remove(), regulator_bulk_disable()
cuts power to the hardware, wiping the hardware register state. However, the
regmap cache survives because it is tied to the persistent i2c device. When
power is restored here during a rebind, the hardware resets to defaults, but
because regcache_mark_dirty() is not called, subsequent regmap updates that
match the stale cache will be skipped.
[ ... ]
> @@ -800,6 +822,7 @@ static void es8316_remove(struct snd_soc_component *component)
> struct es8316_priv *es8316 = snd_soc_component_get_drvdata(component);
>
> clk_disable_unprepare(es8316->mclk);
> + regulator_bulk_disable(ES8316_NUM_SUPPLIES, es8316->supplies);
> }
[Severity: High]
Is the regmap missing cache-only protection while the regulators are
disabled?
The regmap is initialized in es8316_i2c_probe() and persists until the i2c
device is removed. When the hardware is powered down here, can a read via
the regmap debugfs interface attempt physical i2c accesses to the unpowered
device?
[Severity: High]
This isn't a bug introduced by this patch, but does es8316_irq() use an
uninitialized stack variable if the i2c read fails?
sound/soc/codecs/es8316.c:es8316_irq() {
...
unsigned int flags;
mutex_lock(&es8316->lock);
regmap_read(es8316->regmap, ES8316_GPIO_FLAG, &flags);
if (flags == 0x00)
goto out;
...
}
If a transient i2c bus error causes regmap_read() to fail and return an
error code, flags remains uninitialized. Will the function then evaluate
garbage data from the stack to determine the jack status?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260723-es8316-regulator-next-20260722-v1-0-721f757879a0@thundersoft.com?part=2
prev parent reply other threads:[~2026-07-23 8:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 7:54 [PATCH 0/2] ASoC: es8316: Add regulator support Hongyang Zhao
2026-07-23 7:54 ` [PATCH 1/2] ASoC: dt-bindings: es8316: Add regulator supplies Hongyang Zhao
2026-07-23 8:40 ` sashiko-bot
2026-07-23 7:54 ` [PATCH 2/2] ASoC: codecs: es8316: Add regulator support Hongyang Zhao
2026-07-23 8:51 ` sashiko-bot [this message]
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=20260723085123.F30FF1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=hongyang.zhao@thundersoft.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 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.