From a118fea777a2c04da7c5ccf1141d317838a79a46 Mon Sep 17 00:00:00 2001 From: Pengpeng Hou Date: Sat, 4 Jul 2026 15:27:12 +0800 Subject: [PATCH] ASoC: codecs: cs42l42-sdw: Propagate regcache_sync() errors 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 Reviewed-by: Richard Fitzgerald Link: https://patch.msgid.link/20260704072712.91035-1-pengpeng@iscas.ac.cn Signed-off-by: Mark Brown --- 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 b8256ce0b8fb..f1efbc2b532b 100644 --- a/sound/soc/codecs/cs42l42-sdw.c +++ b/sound/soc/codecs/cs42l42-sdw.c @@ -482,10 +482,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)