Skip to content

Commit dc95d6e

Browse files
tq-steinasmb49
authored andcommitted
regmap: cache: Return error in cache sync operations for REGCACHE_NONE
BugLink: https://bugs.launchpad.net/bugs/2028808 [ Upstream commit fd883d7 ] There is no sense in doing a cache sync on REGCACHE_NONE regmaps. Instead of panicking the kernel due to missing cache_ops, return an error to client driver. Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> Link: https://lore.kernel.org/r/20230313071812.13577-1-alexander.stein@ew.tq-group.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent 89c0fa8 commit dc95d6e

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

drivers/base/regmap/regcache.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,9 @@ int regcache_sync(struct regmap *map)
349349
const char *name;
350350
bool bypass;
351351

352+
if (WARN_ON(map->cache_type == REGCACHE_NONE))
353+
return -EINVAL;
354+
352355
BUG_ON(!map->cache_ops);
353356

354357
map->lock(map->lock_arg);
@@ -418,6 +421,9 @@ int regcache_sync_region(struct regmap *map, unsigned int min,
418421
const char *name;
419422
bool bypass;
420423

424+
if (WARN_ON(map->cache_type == REGCACHE_NONE))
425+
return -EINVAL;
426+
421427
BUG_ON(!map->cache_ops);
422428

423429
map->lock(map->lock_arg);

0 commit comments

Comments
 (0)