Skip to content

Commit ee43f5b

Browse files
groeckbroonie
authored andcommitted
regmap: Reject fast_io regmap configurations with RBTREE and MAPLE caches
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 <linux@roeck-us.net> Link: https://lore.kernel.org/r/20230720032848.1306349-2-linux@roeck-us.net Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 99aae70 commit ee43f5b

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

drivers/base/regmap/regmap.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,15 @@ struct regmap *__regmap_init(struct device *dev,
723723
} else {
724724
if ((bus && bus->fast_io) ||
725725
config->fast_io) {
726+
/*
727+
* fast_io is incompatible with REGCACHE_RBTREE and REGCACHE_MAPLE
728+
* since both need to dynamically allocate memory.
729+
*/
730+
if (config->cache_type == REGCACHE_RBTREE ||
731+
config->cache_type == REGCACHE_MAPLE) {
732+
ret = -EINVAL;
733+
goto err_name;
734+
}
726735
if (config->use_raw_spinlock) {
727736
raw_spin_lock_init(&map->raw_spinlock);
728737
map->lock = regmap_lock_raw_spinlock;

0 commit comments

Comments
 (0)