[PATCH] ASoC: codecs: rt721-sdca-sdw: Propagate regcache_sync() errors

From: Pengpeng Hou

Date: Sat Jul 04 2026 - 03:39:59 EST


rt721_sdca_dev_resume() clears cache-only mode for both regmaps and
replays cached register state. Both regcache_sync() calls currently
ignore their return values.

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

Signed-off-by: Pengpeng Hou <pengpeng@xxxxxxxxxxx>
---
sound/soc/codecs/rt721-sdca-sdw.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/rt721-sdca-sdw.c b/sound/soc/codecs/rt721-sdca-sdw.c
index 041b381e582b..4f3d6f8d9b81 100644
--- a/sound/soc/codecs/rt721-sdca-sdw.c
+++ b/sound/soc/codecs/rt721-sdca-sdw.c
@@ -509,11 +509,24 @@ static int rt721_sdca_dev_resume(struct device *dev)
return ret;
}

- regcache_cache_only(rt721->regmap, false);
- regcache_sync(rt721->regmap);
+ regcache_cache_only(rt721->regmap, false);
+ ret = regcache_sync(rt721->regmap);
+ if (ret)
+ goto err_sync;
+
regcache_cache_only(rt721->mbq_regmap, false);
- regcache_sync(rt721->mbq_regmap);
+ ret = regcache_sync(rt721->mbq_regmap);
+ if (ret)
+ goto err_sync;
+
return 0;
+
+err_sync:
+ regcache_cache_only(rt721->regmap, true);
+ regcache_cache_only(rt721->mbq_regmap, true);
+ regcache_mark_dirty(rt721->regmap);
+ regcache_mark_dirty(rt721->mbq_regmap);
+ return ret;
}

static const struct dev_pm_ops rt721_sdca_pm = {
--
2.43.0