Skip to content

Commit fd883d7

Browse files
tq-steinabroonie
authored andcommitted
regmap: cache: Return error in cache sync operations for REGCACHE_NONE
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>
1 parent 83c05c9 commit fd883d7

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)