From: Pengpeng Hou <hppiscas@163.com>
To: Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>
Cc: Pengpeng Hou <hppiscas@163.com>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>,
David Yang <yangxiaohua@everest-semi.com>,
Zhu Ning <zhuning0077@gmail.com>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/4] ASoC: es8326: report resume restore errors
Date: Sun, 6 Sep 2026 11:42:14 +0800 [thread overview]
Message-ID: <20260906034217.85696-2-hppiscas@163.com> (raw)
es8326_resume() ignores the status-register read, the direct clock-state
write and the register-cache replay. A read failure can also leave reg
uninitialized before it selects the reset path, and a cache failure is
followed by jack IRQ processing.
Return these errors before later resume work. The ASoC component wrapper
reports the callback failure while retaining its best-effort resume
contract.
The issue was found by our static-analysis tool and manually reviewed.
Fixes: 5c439937775d ("ASoC: codecs: add support for ES8326")
Assisted-by: gpt 5
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
---
sound/soc/codecs/es8326.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index c5460589a88b..ab0280b06e5c 100644
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -1118,18 +1118,28 @@ static int es8326_resume(struct snd_soc_component *component)
{
struct es8326_priv *es8326 = snd_soc_component_get_drvdata(component);
unsigned int reg;
+ int ret;
regcache_cache_only(es8326->regmap, false);
regcache_cache_bypass(es8326->regmap, true);
- regmap_read(es8326->regmap, ES8326_CLK_RESAMPLE, ®);
+ ret = regmap_read(es8326->regmap, ES8326_CLK_RESAMPLE, ®);
regcache_cache_bypass(es8326->regmap, false);
+ if (ret)
+ return ret;
+
/* reset internal clock state */
- if (reg == 0x05)
- regmap_write(es8326->regmap, ES8326_CLK_CTL, ES8326_CLK_ON);
- else
+ if (reg == 0x05) {
+ ret = regmap_write(es8326->regmap, ES8326_CLK_CTL,
+ ES8326_CLK_ON);
+ if (ret)
+ return ret;
+ } else {
es8326_init(component);
+ }
- regcache_sync(es8326->regmap);
+ ret = regcache_sync(es8326->regmap);
+ if (ret)
+ return ret;
es8326_irq(es8326->irq, es8326);
return 0;
--
2.50.1 (Apple Git-155)
next reply other threads:[~2026-09-06 3:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-06 3:42 Pengpeng Hou [this message]
2026-09-07 22:49 ` [PATCH 1/4] ASoC: es8326: report resume restore errors Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260906034217.85696-2-hppiscas@163.com \
--to=hppiscas@163.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=yangxiaohua@everest-semi.com \
--cc=zhuning0077@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox