[PATCH 07/20] ASoC: max98088: Propagate cache replay errors from bias restore

Pengpeng Hou <[email protected]>
Newsgroups gmane.linux.sound,gmane.linux.kernel
Message-ID <[email protected]>
max98088_set_bias_level() replays cached registers during the
OFF-to-STANDBY transition but ignores failure and enables additional
power bits.

Return the replay error before those writes and keep the cache dirty for
a later retry.

The issue was identified via static analysis and manually reviewed.

Fixes: e86e1244a413 ("ASoC: Restore MAX98088 CODEC driver")

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

diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c
index df438baf05dc..b1e7a03f3408 100644
--- a/sound/soc/codecs/max98088.c
+++ b/sound/soc/codecs/max98088.c
@@ -1323,8 +1323,13 @@ static int max98088_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)
-			regcache_sync(max98088->regmap);
+		if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) {
+			ret = regcache_sync(max98088->regmap);
+			if (ret) {
+				regcache_mark_dirty(max98088->regmap);
+				return ret;
+			}
+		}
 
 		snd_soc_component_update_bits(component, M98088_REG_4C_PWR_EN_IN,
 				   M98088_MBEN, M98088_MBEN);
-- 
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.