[PATCH 13/20] ASoC: wm8804: Propagate cache replay errors from runtime resume

Pengpeng Hou <[email protected]>
Newsgroups gmane.linux.kernel,gmane.linux.sound
Message-ID <[email protected]>
wm8804_runtime_resume() enables supplies and ignores regcache_sync(),
then powers up OSCCLK and reports runtime-PM success.

Return the cache error and disable the supplies acquired by resume
before OSCCLK is enabled.

The issue was identified via static analysis and manually reviewed.

Fixes: 1a60667fc81f ("ASoC: wm8804: Enable runtime PM")

Assisted-by: LLM
Signed-off-by: Pengpeng Hou <[email protected]>
---
 sound/soc/codecs/wm8804.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c
index 94aa3c8de0ab..0935e2e3c2d4 100644
--- a/sound/soc/codecs/wm8804.c
+++ b/sound/soc/codecs/wm8804.c
@@ -692,7 +692,11 @@ static int wm8804_runtime_resume(struct device *dev)
 		return ret;
 	}
 
-	regcache_sync(wm8804->regmap);
+	ret = regcache_sync(wm8804->regmap);
+	if (ret) {
+		regulator_bulk_disable(ARRAY_SIZE(wm8804->supplies), wm8804->supplies);
+		return ret;
+	}
 
 	/* Power up OSCCLK */
 	regmap_update_bits(wm8804->regmap, WM8804_PWRDN, 0x8, 0x0);
-- 
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.