Re: [PATCH] ASoC: codecs: cs42l42-sdw: Propagate regcache_sync() errors

From: Richard Fitzgerald

Date: Mon Jul 06 2026 - 04:39:37 EST


On 04/07/2026 8:27 am, Pengpeng Hou wrote:
cs42l42_sdw_runtime_resume() first syncs LATCH_TO_VP and then syncs the
full regmap, but currently ignores both return values and can report
success after a failed replay.

Check both sync operations, return the first error, and restore cache-
only/dirty state on failure.

Signed-off-by: Pengpeng Hou <pengpeng@xxxxxxxxxxx>
---
sound/soc/codecs/cs42l42-sdw.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/cs42l42-sdw.c b/sound/soc/codecs/cs42l42-sdw.c
index ad1256910a18..b61ca74dcf0b 100644
--- a/sound/soc/codecs/cs42l42-sdw.c
+++ b/sound/soc/codecs/cs42l42-sdw.c
@@ -481,10 +481,20 @@ static int cs42l42_sdw_runtime_resume(struct device *dev)
regcache_cache_only(cs42l42->regmap, false);
/* Sync LATCH_TO_VP first so the VP domain registers sync correctly */
- regcache_sync_region(cs42l42->regmap, CS42L42_MIC_DET_CTL1, CS42L42_MIC_DET_CTL1);
- regcache_sync(cs42l42->regmap);
+ ret = regcache_sync_region(cs42l42->regmap, CS42L42_MIC_DET_CTL1, CS42L42_MIC_DET_CTL1);
+ if (ret)
+ goto err_sync;
+
+ ret = regcache_sync(cs42l42->regmap);
+ if (ret)
+ goto err_sync;
return 0;
+
+err_sync:
+ regcache_cache_only(cs42l42->regmap, true);
+ regcache_mark_dirty(cs42l42->regmap);
+ return ret;
}
static int cs42l42_sdw_resume(struct device *dev)

Reviewed-by: Richard Fitzgerald <rf@xxxxxxxxxxxxxxxxxxxxx>