[PATCH] ASoC: codecs: rt5645: Propagate regcache_sync() errors
From: Pengpeng Hou
Date: Sat Jul 04 2026 - 03:20:58 EST
Both rt5645_resume() and rt5645_sys_resume() leave cache-only mode and
replay cached register state, but both paths ignore regcache_sync()
failures and can report success.
Check both sync operations, return the error, and restore cache-
only/dirty state on failure.
Signed-off-by: Pengpeng Hou <pengpeng@xxxxxxxxxxx>
---
sound/soc/codecs/rt5645.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index e9819653b30d..93a4148ccccd 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -3518,9 +3518,15 @@ static int rt5645_suspend(struct snd_soc_component *component)
static int rt5645_resume(struct snd_soc_component *component)
{
struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component);
+ int ret;
regcache_cache_only(rt5645->regmap, false);
- regcache_sync(rt5645->regmap);
+ ret = regcache_sync(rt5645->regmap);
+ if (ret) {
+ regcache_cache_only(rt5645->regmap, true);
+ regcache_mark_dirty(rt5645->regmap);
+ return ret;
+ }
return 0;
}
@@ -4331,9 +4337,15 @@ static int rt5645_sys_suspend(struct device *dev)
static int rt5645_sys_resume(struct device *dev)
{
struct rt5645_priv *rt5645 = dev_get_drvdata(dev);
+ int ret;
regcache_cache_only(rt5645->regmap, false);
- regcache_sync(rt5645->regmap);
+ ret = regcache_sync(rt5645->regmap);
+ if (ret) {
+ regcache_cache_only(rt5645->regmap, true);
+ regcache_mark_dirty(rt5645->regmap);
+ return ret;
+ }
if (rt5645->hp_jack) {
rt5645->jack_type = 0;
--
2.43.0