]> git.baikalelectronics.ru Git - kernel.git/commit
regmap: regcache-rbtree: Clean new present bits on present bitmap resize
authorGuenter Roeck <linux@roeck-us.net>
Mon, 27 Jul 2015 04:34:50 +0000 (21:34 -0700)
committerMark Brown <broonie@kernel.org>
Wed, 29 Jul 2015 14:10:13 +0000 (15:10 +0100)
commitfbf676777ba3a74209b5a77bec7c2a74388ed09c
tree555b99af183bc6798d1b08b3f01f70d18b6eb3ba
parent0c9e0229f3c4e023815b9350b2095fd8ad5809e3
regmap: regcache-rbtree: Clean new present bits on present bitmap resize

When inserting a new register into a block, the present bit map size is
increased using krealloc. krealloc does not clear the additionally
allocated memory, leaving it filled with random values. Result is that
some registers are considered cached even though this is not the case.

Fix the problem by clearing the additionally allocated memory. Also, if
the bitmap size does not increase, do not reallocate the bitmap at all
to reduce overhead.

Fixes: 0960ee98eb5b ("regmap: rbtree: Make cache_present bitmap per node")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
drivers/base/regmap/regcache-rbtree.c