[PATCH 11/20] ASoC: wm8731: Unwind supplies on cache replay failure

From: Pengpeng Hou

Date: Fri Aug 28 2026 - 07:35:58 EST


wm8731_set_bias_level() enables supplies and then ignores
regcache_sync() during the OFF-to-STANDBY transition. It continues with
power-register programming after an incomplete restore.

Return the cache error and disable the supplies acquired for the failed
transition.

The issue was identified via static analysis and manually reviewed.

Fixes: 9bf311fe17f1 ("ASoC: wm8731: Convert to snd_soc_cache_sync")

Assisted-by: LLM
Signed-off-by: Pengpeng Hou <pengpeng@xxxxxxxxxxx>
---
sound/soc/codecs/wm8731.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
index ce87280d590d..93d37279b6de 100644
--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -483,7 +483,12 @@ static int wm8731_set_bias_level(struct snd_soc_component *component,
if (ret != 0)
return ret;

- regcache_sync(wm8731->regmap);
+ ret = regcache_sync(wm8731->regmap);
+ if (ret) {
+ regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies),
+ wm8731->supplies);
+ return ret;
+ }
}

/* Clear PWROFF, gate CLKOUT, everything else as-is */
--
2.43.0