[PATCH 17/20] ASoC: wm8993: Unwind supplies on cache replay failure
From: Pengpeng Hou
Date: Fri Aug 28 2026 - 07:41:21 EST
wm8993_set_bias_level() enables supplies, makes the regmap live and
ignores regcache_sync() before VMID programming.
Return the cache error after restoring cache-only and dirty state and
disabling the supplies acquired for the failed transition.
The issue was identified via static analysis and manually reviewed.
Fixes: cf56f62746c3 ("ASoC: Disable WM8993 regulators when turning bias off")
Assisted-by: LLM
Signed-off-by: Pengpeng Hou <pengpeng@xxxxxxxxxxx>
---
sound/soc/codecs/wm8993.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c
index 2a94b23319b5..5f7ecee6ea0f 100644
--- a/sound/soc/codecs/wm8993.c
+++ b/sound/soc/codecs/wm8993.c
@@ -996,7 +996,14 @@ static int wm8993_set_bias_level(struct snd_soc_component *component,
return ret;
regcache_cache_only(wm8993->regmap, false);
- regcache_sync(wm8993->regmap);
+ ret = regcache_sync(wm8993->regmap);
+ if (ret) {
+ regcache_cache_only(wm8993->regmap, true);
+ regcache_mark_dirty(wm8993->regmap);
+ regulator_bulk_disable(ARRAY_SIZE(wm8993->supplies),
+ wm8993->supplies);
+ return ret;
+ }
wm_hubs_vmid_ena(component);
--
2.43.0