[PATCH 03/20] ASoC: cs35l56: Propagate register restore errors from runtime resume

Pengpeng Hou <[email protected]>
Newsgroups gmane.linux.sound,gmane.linux.kernel
Message-ID <[email protected]>
cs35l56_runtime_resume_common() checks firmware wake and mailbox errors
but ignores the BOOT_DONE read and register-cache replay.  A failed read
also leaves val undefined before the BOOT_DONE test.

Send both failures through the existing hibernate error path so
cache-only state is restored and the device is returned to hibernate
when supported.

The issue was identified via static analysis and manually reviewed.

Fixes: e49611252900 ("ASoC: cs35l56: Add driver for Cirrus Logic CS35L56")

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

diff --git a/sound/soc/codecs/cs35l56-shared.c b/sound/soc/codecs/cs35l56-shared.c
index 7b3e37d462d6..3778c5c2d910 100644
--- a/sound/soc/codecs/cs35l56-shared.c
+++ b/sound/soc/codecs/cs35l56-shared.c
@@ -827,13 +827,18 @@ int cs35l56_runtime_resume_common(struct cs35l56_base *cs35l56_base, bool is_sou
 		goto err;
 
 	/* BOOT_DONE will be 1 if the amp reset */
-	regmap_read(cs35l56_base->regmap, CS35L56_IRQ1_EINT_4, &val);
+	ret = regmap_read(cs35l56_base->regmap, CS35L56_IRQ1_EINT_4, &val);
+	if (ret)
+		goto err;
+
 	if (val & CS35L56_OTP_BOOT_DONE_MASK) {
 		dev_dbg(cs35l56_base->dev, "Registers reset in suspend\n");
 		regcache_mark_dirty(cs35l56_base->regmap);
 	}
 
-	regcache_sync(cs35l56_base->regmap);
+	ret = regcache_sync(cs35l56_base->regmap);
+	if (ret)
+		goto err;
 
 	dev_dbg(cs35l56_base->dev, "Resumed");
 
-- 
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.