summaryrefslogtreecommitdiff
path: root/drivers/atm
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2022-07-09 17:05:45 +0200
committerJakub Kicinski <kuba@kernel.org>2022-07-11 19:49:53 -0700
commit9e433ac1a381bb1fa5e7ccbe3d226780e5b10bed (patch)
tree4c78659b4ca4a48dbf0d3b451521bc5d81fe37f3 /drivers/atm
parent2b8bf3d6c99318eae669e3098c490ba6b508fd37 (diff)
downloadlwn-9e433ac1a381bb1fa5e7ccbe3d226780e5b10bed.tar.gz
lwn-9e433ac1a381bb1fa5e7ccbe3d226780e5b10bed.zip
atm: he: Use the bitmap API to allocate bitmaps
Use bitmap_zalloc()/bitmap_free() instead of hand-writing them. It is less verbose and it improves the semantic. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/7f795bd6d5b2a00f581175b7069b229c2e5a4192.1657379127.git.christophe.jaillet@wanadoo.fr Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/atm')
-rw-r--r--drivers/atm/he.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index 17f44abc9418..ad91cc6a34fc 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -780,14 +780,11 @@ static int he_init_group(struct he_dev *he_dev, int group)
G0_RBPS_BS + (group * 32));
/* bitmap table */
- he_dev->rbpl_table = kmalloc_array(BITS_TO_LONGS(RBPL_TABLE_SIZE),
- sizeof(*he_dev->rbpl_table),
- GFP_KERNEL);
+ he_dev->rbpl_table = bitmap_zalloc(RBPL_TABLE_SIZE, GFP_KERNEL);
if (!he_dev->rbpl_table) {
hprintk("unable to allocate rbpl bitmap table\n");
return -ENOMEM;
}
- bitmap_zero(he_dev->rbpl_table, RBPL_TABLE_SIZE);
/* rbpl_virt 64-bit pointers */
he_dev->rbpl_virt = kmalloc_array(RBPL_TABLE_SIZE,
@@ -902,7 +899,7 @@ out_destroy_rbpl_pool:
out_free_rbpl_virt:
kfree(he_dev->rbpl_virt);
out_free_rbpl_table:
- kfree(he_dev->rbpl_table);
+ bitmap_free(he_dev->rbpl_table);
return -ENOMEM;
}
@@ -1578,7 +1575,7 @@ he_stop(struct he_dev *he_dev)
}
kfree(he_dev->rbpl_virt);
- kfree(he_dev->rbpl_table);
+ bitmap_free(he_dev->rbpl_table);
dma_pool_destroy(he_dev->rbpl_pool);
if (he_dev->rbrq_base)