[PATCH 16/19] ASoC: codecs: rt1320-sdw: Propagate regcache_sync() errors
From: Pengpeng Hou
Date: Sat Jul 04 2026 - 00:05:13 EST
rt1320_dev_resume() clears cache-only mode for both regmaps and
replays cached register state into the device. Both regcache_sync()
calls currently ignore their return values, so resume can report
success even if either replay failed.
Check both sync operations and return the first error. On failure,
restore both regmaps to cache-only mode and mark both caches dirty,
so a later successful resume attempt starts from a coherent suspended
cache state instead of a partially live pair of regmaps.
Signed-off-by: Pengpeng Hou <pengpeng@xxxxxxxxxxx>
---
sound/soc/codecs/rt1320-sdw.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/rt1320-sdw.c b/sound/soc/codecs/rt1320-sdw.c
index 1e930b27c67a..b7e2d44ae2fb 100644
--- a/sound/soc/codecs/rt1320-sdw.c
+++ b/sound/soc/codecs/rt1320-sdw.c
@@ -3062,10 +3062,23 @@ static int rt1320_dev_resume(struct device *dev)
return ret;
regcache_cache_only(rt1320->regmap, false);
- regcache_sync(rt1320->regmap);
+ ret = regcache_sync(rt1320->regmap);
+ if (ret)
+ goto err_sync;
+
regcache_cache_only(rt1320->mbq_regmap, false);
- regcache_sync(rt1320->mbq_regmap);
+ ret = regcache_sync(rt1320->mbq_regmap);
+ if (ret)
+ goto err_sync;
+
return 0;
+
+err_sync:
+ regcache_cache_only(rt1320->regmap, true);
+ regcache_cache_only(rt1320->mbq_regmap, true);
+ regcache_mark_dirty(rt1320->regmap);
+ regcache_mark_dirty(rt1320->mbq_regmap);
+ return ret;
}
static const struct dev_pm_ops rt1320_pm = {
--
2.43.0