[PATCH v2 2/2] regcache: Validate cache_only state in regcache_sync_region()
| Newsgroups | dev.linux.lists.driver-core,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
From: bui duc phuc <[email protected]> Add a WARN_ON() check to ensure regcache_sync_region() is not called while cache_only is enabled. Signed-off-by: bui duc phuc <[email protected]> --- 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