[PATCH 15/20] ASoC: wm8985: Unwind supplies on cache replay failure

Pengpeng Hou <[email protected]>
Newsgroups gmane.linux.kernel,gmane.linux.sound
Message-ID <[email protected]>
wm8985_set_bias_level() enables supplies and ignores regcache_sync(),
then performs the anti-pop and bias power-up sequence.

Return the cache error and disable the supplies acquired for the failed
OFF-to-STANDBY transition.

The issue was identified via static analysis and manually reviewed.

Fixes: 6d6f8b832705 ("ASoC: WM8985: Initial driver")

Assisted-by: LLM
Signed-off-by: Pengpeng Hou <[email protected]>
---
 sound/soc/codecs/wm8985.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wm8985.c b/sound/soc/codecs/wm8985.c
index 2a64d5a851da..10658d9a42d0 100644
--- a/sound/soc/codecs/wm8985.c
+++ b/sound/soc/codecs/wm8985.c
@@ -971,7 +971,12 @@ static int wm8985_set_bias_level(struct snd_soc_component *component,
 				return ret;
 			}
 
-			regcache_sync(wm8985->regmap);
+			ret = regcache_sync(wm8985->regmap);
+			if (ret) {
+				regulator_bulk_disable(ARRAY_SIZE(wm8985->supplies),
+						       wm8985->supplies);
+				return ret;
+			}
 
 			/* enable anti-pop features */
 			snd_soc_component_update_bits(component, WM8985_OUT4_TO_ADC,
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.