Skip to content

Commit

Permalink
regmap: Reject fast_io regmap configurations with RBTREE and MAPLE ca…
Browse files Browse the repository at this point in the history
…ches

REGCACHE_RBTREE and REGCACHE_MAPLE dynamically allocate memory for regmap
operations. This is incompatible with spinlock based locking which is used
for fast_io operations. Reject affected configurations.

Signed-off-by: Guenter Roeck <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
groeck authored and broonie committed Jul 20, 2023
1 parent 99aae70 commit ee43f5b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/base/regmap/regmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,15 @@ struct regmap *__regmap_init(struct device *dev,
} else {
if ((bus && bus->fast_io) ||
config->fast_io) {
/*
* fast_io is incompatible with REGCACHE_RBTREE and REGCACHE_MAPLE
* since both need to dynamically allocate memory.
*/
if (config->cache_type == REGCACHE_RBTREE ||
config->cache_type == REGCACHE_MAPLE) {
ret = -EINVAL;
goto err_name;
}
if (config->use_raw_spinlock) {
raw_spin_lock_init(&map->raw_spinlock);
map->lock = regmap_lock_raw_spinlock;
Expand Down

0 comments on commit ee43f5b

Please sign in to comment.