[PATCH] clk: si521xx: restore cache_only on regcache_sync() failure in resume

phucduc.bui@gmail.com posted 1 patch 14 hours ago
drivers/clk/clk-si521xx.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[PATCH] clk: si521xx: restore cache_only on regcache_sync() failure in resume
Posted by phucduc.bui@gmail.com 14 hours ago
From: bui duc phuc <phucduc.bui@gmail.com>

If regcache_sync() fails in si521xx_resume(), the function only logs the
error, leaving regmap with cache_only disabled even though the register
cache has not been synchronized with the hardware.
Re-enable cache_only on failure to restore the state established by
si521xx_suspend().

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 drivers/clk/clk-si521xx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-si521xx.c b/drivers/clk/clk-si521xx.c
index ceadc07bcb6d..e96d5d082624 100644
--- a/drivers/clk/clk-si521xx.c
+++ b/drivers/clk/clk-si521xx.c
@@ -358,8 +358,10 @@ static int __maybe_unused si521xx_resume(struct device *dev)
 
 	regcache_cache_only(si->regmap, false);
 	ret = regcache_sync(si->regmap);
-	if (ret)
+	if (ret) {
+		regcache_cache_only(si->regmap, true);
 		dev_err(dev, "Failed to restore register map: %d\n", ret);
+	}
 	return ret;
 }
 
-- 
2.43.0