diff options
| author | Pengpeng Hou <hppiscas@163.com> | 2026-09-06 11:42:16 +0800 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-09-07 23:48:56 +0100 |
| commit | 8f7d23eb8ffb817ba69049577ab8ca55b93c77cf (patch) | |
| tree | 62131eef18c577d9b3b7ee00a8e05e99c4c1282a | |
| parent | 8f43acfd3addf10fbde8d21dd44b1a61e1936ba7 (diff) | |
| download | linux-next-8f7d23eb8ffb817ba69049577ab8ca55b93c77cf.tar.gz linux-next-8f7d23eb8ffb817ba69049577ab8ca55b93c77cf.zip | |
ASoC: es8389: report resume restore errors
es8389_resume() ignores the reset-register read, bias restoration and
register-cache replay. A failed read can leave regv uninitialized before
it selects the initialization path.
Check those operations and always leave cache bypass before returning an
error. The ASoC component wrapper reports callback failures while retaining
its best-effort resume contract.
The issue was found by our static-analysis tool and manually reviewed.
Fixes: 0319c26889f7 ("ASoC: codecs: add support for ES8389")
Assisted-by: gpt 5
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
Link: https://patch.msgid.link/20260906034217.85696-4-hppiscas@163.com
Signed-off-by: Mark Brown <broonie@kernel.org>
| -rw-r--r-- | sound/soc/codecs/es8389.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c index 80efce3e0a22..204fe6731140 100644 --- a/sound/soc/codecs/es8389.c +++ b/sound/soc/codecs/es8389.c @@ -1026,20 +1026,28 @@ static int es8389_resume(struct snd_soc_component *component) { struct es8389_private *es8389 = snd_soc_component_get_drvdata(component); unsigned int regv; + int ret; regcache_cache_only(es8389->regmap, false); regcache_cache_bypass(es8389->regmap, true); - regmap_read(es8389->regmap, ES8389_RESET, ®v); + ret = regmap_read(es8389->regmap, ES8389_RESET, ®v); + if (ret) + goto disable_bypass; - if (regv == 0xff) + if (regv == 0xff) { es8389_init(component); - else - es8389_set_bias_level(component, SND_SOC_BIAS_ON); + } else { + ret = es8389_set_bias_level(component, SND_SOC_BIAS_ON); + if (ret) + goto disable_bypass; + } +disable_bypass: regcache_cache_bypass(es8389->regmap, false); - regcache_sync(es8389->regmap); + if (ret) + return ret; - return 0; + return regcache_sync(es8389->regmap); } static int es8389_probe(struct snd_soc_component *component) |
