Skip to contentSkip to conversation

ASoC: rt5677: stop IRQ resume when cache sync fails

PATCH In review Pengpeng Hou 1 participant 1 message Sep 6

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 9/9 ASoC: rt5677: stop IRQ resume when cache sync fails

rt5677_resume() ignores a regcache_sync() failure after powering and resetting the codec, then enables the IRQ and schedules a resume check. Those operations assume that the register state has been restored.

Return the cache replay error before publishing IRQ activity. Leave the power GPIO state unchanged on failure because deferred component resume remains best effort and the core still marks the component resumed; rolling power back here would create a contradictory hardware state.

The issue was found by our static-analysis tool and manually reviewed.

Fixes 0e826e867264 ("ASoC: add RT5677 CODEC driver")
Assisted-by gpt 5
---
 sound/soc/codecs/rt5677.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
sound/soc/codecs/rt5677.c +4 -1
index 4757017cc83d..2bcb4e5739d1 100644
@@ -4956,6 +4956,7 @@ static int rt5677_suspend(struct snd_soc_component *component)
 static int rt5677_resume(struct snd_soc_component *component)
 {
 	struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component);
+	int ret;
 
 	if (!rt5677->dsp_vad_en) {
 		rt5677->pll_src = 0;
@@ -4967,7 +4968,9 @@ static int rt5677_resume(struct snd_soc_component *component)
 			msleep(10);
 
 		regcache_cache_only(rt5677->regmap, false);
-		regcache_sync(rt5677->regmap);
+		ret = regcache_sync(rt5677->regmap);
+		if (ret)
+			return ret;
 	}
 
 	if (rt5677->irq) {
Signature · 1 line
2.50.1 (Apple Git-155)