* [PATCH v1 1/2] ASoC: es8311: Check regcache_sync() error in resume
2026-04-15 3:02 [PATCH v1 0/2] ASoC: es8311: Improve error handling and power Hsieh Hung-En
@ 2026-04-15 3:02 ` Hsieh Hung-En
2026-04-15 3:02 ` [PATCH v1 2/2] ASoC: es8311: Fix clock leak and check update_bits in set_bias_level() Hsieh Hung-En
2026-04-16 12:39 ` [PATCH v1 0/2] ASoC: es8311: Improve error handling and power Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Hsieh Hung-En @ 2026-04-15 3:02 UTC (permalink / raw)
To: broonie, lgirdwood
Cc: linux-sound, perex, tiwai, ckeepax, kuninori.morimoto.gx,
matteomartelli3, Hsieh Hung-En
The es8311_resume() function currently ignores the return value of
regcache_sync(). If syncing the cache fails, the function still returns
0, leaving the codec in a potentially incorrect state.
Check the return value and propagate it to the ASoC core to ensure
resume failures are properly handled.
Signed-off-by: Hsieh Hung-En <hungen3108@gmail.com>
---
sound/soc/codecs/es8311.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/es8311.c b/sound/soc/codecs/es8311.c
index 0b07a53cc792..9e371e2d6eae 100644
--- a/sound/soc/codecs/es8311.c
+++ b/sound/soc/codecs/es8311.c
@@ -862,13 +862,18 @@ static int es8311_suspend(struct snd_soc_component *component)
static int es8311_resume(struct snd_soc_component *component)
{
struct es8311_priv *es8311;
+ int ret;
es8311 = snd_soc_component_get_drvdata(component);
es8311_reset(component, false);
regcache_cache_only(es8311->regmap, false);
- regcache_sync(es8311->regmap);
+ ret = regcache_sync(es8311->regmap);
+ if (ret) {
+ dev_err(component->dev, "unable to sync regcache\n");
+ return ret;
+ }
return 0;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH v1 2/2] ASoC: es8311: Fix clock leak and check update_bits in set_bias_level()
2026-04-15 3:02 [PATCH v1 0/2] ASoC: es8311: Improve error handling and power Hsieh Hung-En
2026-04-15 3:02 ` [PATCH v1 1/2] ASoC: es8311: Check regcache_sync() error in resume Hsieh Hung-En
@ 2026-04-15 3:02 ` Hsieh Hung-En
2026-04-16 12:39 ` [PATCH v1 0/2] ASoC: es8311: Improve error handling and power Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Hsieh Hung-En @ 2026-04-15 3:02 UTC (permalink / raw)
To: broonie, lgirdwood
Cc: linux-sound, perex, tiwai, ckeepax, kuninori.morimoto.gx,
matteomartelli3, Hsieh Hung-En
In es8311_set_bias_level(), the return value of
snd_soc_component_update_bits() was ignored. If this fails, not only
is the VMID selection not applied, but the previously enabled mclk
is left running, leading to an unbalanced clock reference count
(clock leak).
Check the return value and ensure clk_disable_unprepare() is called on
failure to maintain proper resource management.
Signed-off-by: Hsieh Hung-En <hungen3108@gmail.com>
---
sound/soc/codecs/es8311.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/sound/soc/codecs/es8311.c b/sound/soc/codecs/es8311.c
index 9e371e2d6eae..564af5c04dbb 100644
--- a/sound/soc/codecs/es8311.c
+++ b/sound/soc/codecs/es8311.c
@@ -761,6 +761,7 @@ static int es8311_set_bias_level(struct snd_soc_component *component,
{
struct es8311_priv *es8311 = snd_soc_component_get_drvdata(component);
struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
+ int ret;
switch (level) {
case SND_SOC_BIAS_ON:
@@ -769,17 +770,21 @@ static int es8311_set_bias_level(struct snd_soc_component *component,
break;
case SND_SOC_BIAS_STANDBY:
if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
- int ret = clk_prepare_enable(es8311->mclk);
+ ret = clk_prepare_enable(es8311->mclk);
if (ret) {
dev_err(component->dev,
"unable to prepare mclk\n");
return ret;
}
- snd_soc_component_update_bits(
- component, ES8311_SYS3,
- ES8311_SYS3_PDN_VMIDSEL_MASK,
- ES8311_SYS3_PDN_VMIDSEL_STARTUP_NORMAL_SPEED);
+ ret = snd_soc_component_update_bits(
+ component, ES8311_SYS3,
+ ES8311_SYS3_PDN_VMIDSEL_MASK,
+ ES8311_SYS3_PDN_VMIDSEL_STARTUP_NORMAL_SPEED);
+ if (ret < 0) {
+ clk_disable_unprepare(es8311->mclk);
+ return ret;
+ }
}
break;
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v1 0/2] ASoC: es8311: Improve error handling and power
2026-04-15 3:02 [PATCH v1 0/2] ASoC: es8311: Improve error handling and power Hsieh Hung-En
2026-04-15 3:02 ` [PATCH v1 1/2] ASoC: es8311: Check regcache_sync() error in resume Hsieh Hung-En
2026-04-15 3:02 ` [PATCH v1 2/2] ASoC: es8311: Fix clock leak and check update_bits in set_bias_level() Hsieh Hung-En
@ 2026-04-16 12:39 ` Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2026-04-16 12:39 UTC (permalink / raw)
To: lgirdwood, Hsieh Hung-En
Cc: linux-sound, perex, tiwai, ckeepax, kuninori.morimoto.gx,
matteomartelli3
On Wed, 15 Apr 2026 11:02:50 +0800, Hsieh Hung-En wrote:
> ASoC: es8311: Improve error handling and power
>
> This series improves the robustness of the ES8311 codec driver by
> checking return values of register operations and ensuring proper
> clock resource management.
>
> The first patch checks regcache_sync() during resume.
> The second patch fixes a clock reference count leak and checks
> update_bits during bias level transitions.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.1
Thanks!
[1/2] ASoC: es8311: Check regcache_sync() error in resume
https://git.kernel.org/broonie/sound/c/37e9faf21670
[2/2] ASoC: es8311: Fix clock leak and check update_bits in set_bias_level()
https://git.kernel.org/broonie/sound/c/c15bc1681045
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 4+ messages in thread