summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorbui duc phuc <phucduc.bui@gmail.com>2026-07-20 10:32:38 +0700
committerMark Brown <broonie@kernel.org>2026-07-20 18:45:14 +0100
commitafc8e3ee83078eb5dab5a9ea561cdb0008f64f5d (patch)
tree7f6b034d0ded6240fc6f9771f83337729221ca67 /drivers/base
parent86fc3483a4d60f575533d1d5542bacca2a25ddc7 (diff)
downloadlinux-afc8e3ee83078eb5dab5a9ea561cdb0008f64f5d.tar.gz
linux-afc8e3ee83078eb5dab5a9ea561cdb0008f64f5d.zip
regcache: Validate cache_only state in regcache_sync_region()
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@gmail.com> Link: https://patch.msgid.link/20260720033238.52479-2-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/regmap/regcache.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 29a9fda41c44..0e3b6942640c 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -516,6 +516,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;