[PATCH v2 2/2] regcache: Validate cache_only state in regcache_sync_region()
From: phucduc . bui
Date: Sun Jul 19 2026 - 23:33:35 EST
From: bui duc phuc <phucduc.bui@xxxxxxxxx>
Add a WARN_ON() check to ensure regcache_sync_region() is not called
while cache_only is enabled.
Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
---
drivers/base/regmap/regcache.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 20e0641d21b2..be167ee6f57c 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -518,6 +518,10 @@ int regcache_sync_region(struct regmap *map, unsigned int min,
map->lock(map->lock_arg);
+ if (WARN_ON(map->cache_only)) {
+ map->unlock(map->lock_arg);
+ return -EINVAL;
+ }
/* Remember the initial bypass state */
bypass = map->cache_bypass;
--
2.43.0