Commit 1b976f89 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Luis Henriques

regmap: regcache-rbtree: Fix present bitmap resize

commit 328f494d upstream.

When inserting a new register into a block at the lower end the present
bitmap is currently shifted into the wrong direction. The effect of this is
that the bitmap becomes corrupted and registers which are present might be
reported as not present and vice versa.

Fix this by shifting left rather than right.

Fixes: 472fdec7("regmap: rbtree: Reduce number of nodes, take 2")
Reported-by: default avatarDaniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent 41ccbde3
...@@ -307,7 +307,7 @@ static int regcache_rbtree_insert_to_block(struct regmap *map, ...@@ -307,7 +307,7 @@ static int regcache_rbtree_insert_to_block(struct regmap *map,
if (pos == 0) { if (pos == 0) {
memmove(blk + offset * map->cache_word_size, memmove(blk + offset * map->cache_word_size,
blk, rbnode->blklen * map->cache_word_size); blk, rbnode->blklen * map->cache_word_size);
bitmap_shift_right(present, present, offset, blklen); bitmap_shift_left(present, present, offset, blklen);
} }
/* update the rbnode block, its size and the base register */ /* update the rbnode block, its size and the base register */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment