Commit 55535589 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Mark Brown

regmap: lzo: Switch to bitmap_zalloc()

Switch to bitmap_zalloc() to show clearly what we are allocating.
Besides that it returns pointer of bitmap type instead of opaque void *.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 6445500b
...@@ -148,20 +148,18 @@ static int regcache_lzo_init(struct regmap *map) ...@@ -148,20 +148,18 @@ static int regcache_lzo_init(struct regmap *map)
* that register. * that register.
*/ */
bmp_size = map->num_reg_defaults_raw; bmp_size = map->num_reg_defaults_raw;
sync_bmp = kmalloc_array(BITS_TO_LONGS(bmp_size), sizeof(long), sync_bmp = bitmap_zalloc(bmp_size, GFP_KERNEL);
GFP_KERNEL);
if (!sync_bmp) { if (!sync_bmp) {
ret = -ENOMEM; ret = -ENOMEM;
goto err; goto err;
} }
bitmap_zero(sync_bmp, bmp_size);
/* allocate the lzo blocks and initialize them */ /* allocate the lzo blocks and initialize them */
for (i = 0; i < blkcount; i++) { for (i = 0; i < blkcount; i++) {
lzo_blocks[i] = kzalloc(sizeof **lzo_blocks, lzo_blocks[i] = kzalloc(sizeof **lzo_blocks,
GFP_KERNEL); GFP_KERNEL);
if (!lzo_blocks[i]) { if (!lzo_blocks[i]) {
kfree(sync_bmp); bitmap_free(sync_bmp);
ret = -ENOMEM; ret = -ENOMEM;
goto err; goto err;
} }
...@@ -213,7 +211,7 @@ static int regcache_lzo_exit(struct regmap *map) ...@@ -213,7 +211,7 @@ static int regcache_lzo_exit(struct regmap *map)
* only once. * only once.
*/ */
if (lzo_blocks[0]) if (lzo_blocks[0])
kfree(lzo_blocks[0]->sync_bmp); bitmap_free(lzo_blocks[0]->sync_bmp);
for (i = 0; i < blkcount; i++) { for (i = 0; i < blkcount; i++) {
if (lzo_blocks[i]) { if (lzo_blocks[i]) {
kfree(lzo_blocks[i]->wmem); kfree(lzo_blocks[i]->wmem);
......
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