ASoC: nau8821: stop resume when cache sync fails
PATCH 1/9 ASoC: nau8821: stop resume when cache sync fails
nau8821_resume() restores cached registers during component resume but ignores a regcache_sync() failure and continues with IRQ enablement. Those operations assume that the codec register state has already been restored.
Stop the local resume sequence when cache replay fails and return the error to the ASoC component wrapper. The wrapper reports the failure while retaining best-effort card resume, so no rollback or retry semantics are introduced.
The issue was found by our static-analysis tool and manually reviewed.
--- sound/soc/codecs/nau8821.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/codecs/nau8821.c +5 -1
@@ -1628,9 +1628,13 @@ static int __maybe_unused nau8821_suspend(struct snd_soc_component *component)static int __maybe_unused nau8821_resume (struct snd_soc_component *component) {struct nau8821 *nau8821 =snd_soc_component_get_drvdata (component); +int ret;regcache_cache_only (nau8821->regmap, false); -regcache_sync (nau8821->regmap); + ret =regcache_sync (nau8821->regmap); +if (ret) +return ret; +if (nau8821->irq)enable_irq (nau8821->irq);
Signature · 1 line
2.50.1 (Apple Git-155)
Mark Brown
maintainerQuoted 4 lines · Pengpeng Hou
nau8821_resume()restores cached registers during component resume but ignores aregcache_sync()failure and continues with IRQ enablement. Those operations assume that the codec register state has already been restored.
Something seems up with your mail, neither this nor the other series you posted at roughly the same time "ASoC: report additional component restore failures" ended up threaded together.
You might want to look at b4 to send the patches, especially it's web submission endpoint which avoids having to configure mail:
https://b4.docs.kernel.org/en/latest/contributor/overview.html
Mark Brown
maintainersound/soc/codecs/nau8821.c static int __maybe_unused nau8821_suspend(struct snd_soc_component *component) · line 1636
Quoted 10 lines · Pengpeng Hou
nau8821_resume()restores cached registers during component resume but ignores aregcache_sync()failure and continues with IRQ enablement. Those operations assume that the codec register state has already been restored.sound/soc/codecs/nau8821.c +3
-1regcache_cache_only (nau8821->regmap, false); -regcache_sync (nau8821->regmap); + ret =regcache_sync (nau8821->regmap); +if (ret) +return ret;
This leaves the cache in write through mode which is probably going to be a bad time.