summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2015-03-07 17:10:01 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-04-13 14:02:59 +0200
commit0825465c936bcb8feba95d8b40f86dbd716b6623 (patch)
tree34bb820ca863025807ecc0110bec551e45fbe4b5
parent1e529ecd360d27e5fb15782df14d9c5a43ecda13 (diff)
downloadlwn-0825465c936bcb8feba95d8b40f86dbd716b6623.tar.gz
lwn-0825465c936bcb8feba95d8b40f86dbd716b6623.zip
regmap: regcache-rbtree: Fix present bitmap resize
commit 328f494d95aac8bd4896aea2328bc281053bcb71 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: 472fdec7380c("regmap: rbtree: Reduce number of nodes, take 2") Reported-by: Daniel Baluta <daniel.baluta@gmail.com> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/base/regmap/regcache-rbtree.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c
index 930cad4e5df8..2b946bc4212d 100644
--- a/drivers/base/regmap/regcache-rbtree.c
+++ b/drivers/base/regmap/regcache-rbtree.c
@@ -313,7 +313,7 @@ static int regcache_rbtree_insert_to_block(struct regmap *map,
if (pos == 0) {
memmove(blk + offset * 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 */