Commit 9e433ac1 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Jakub Kicinski

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: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/7f795bd6d5b2a00f581175b7069b229c2e5a4192.1657379127.git.christophe.jaillet@wanadoo.frSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 2b8bf3d6
...@@ -780,14 +780,11 @@ static int he_init_group(struct he_dev *he_dev, int group) ...@@ -780,14 +780,11 @@ static int he_init_group(struct he_dev *he_dev, int group)
G0_RBPS_BS + (group * 32)); G0_RBPS_BS + (group * 32));
/* bitmap table */ /* bitmap table */
he_dev->rbpl_table = kmalloc_array(BITS_TO_LONGS(RBPL_TABLE_SIZE), he_dev->rbpl_table = bitmap_zalloc(RBPL_TABLE_SIZE, GFP_KERNEL);
sizeof(*he_dev->rbpl_table),
GFP_KERNEL);
if (!he_dev->rbpl_table) { if (!he_dev->rbpl_table) {
hprintk("unable to allocate rbpl bitmap table\n"); hprintk("unable to allocate rbpl bitmap table\n");
return -ENOMEM; return -ENOMEM;
} }
bitmap_zero(he_dev->rbpl_table, RBPL_TABLE_SIZE);
/* rbpl_virt 64-bit pointers */ /* rbpl_virt 64-bit pointers */
he_dev->rbpl_virt = kmalloc_array(RBPL_TABLE_SIZE, he_dev->rbpl_virt = kmalloc_array(RBPL_TABLE_SIZE,
...@@ -902,7 +899,7 @@ static int he_init_group(struct he_dev *he_dev, int group) ...@@ -902,7 +899,7 @@ static int he_init_group(struct he_dev *he_dev, int group)
out_free_rbpl_virt: out_free_rbpl_virt:
kfree(he_dev->rbpl_virt); kfree(he_dev->rbpl_virt);
out_free_rbpl_table: out_free_rbpl_table:
kfree(he_dev->rbpl_table); bitmap_free(he_dev->rbpl_table);
return -ENOMEM; return -ENOMEM;
} }
...@@ -1578,7 +1575,7 @@ he_stop(struct he_dev *he_dev) ...@@ -1578,7 +1575,7 @@ he_stop(struct he_dev *he_dev)
} }
kfree(he_dev->rbpl_virt); kfree(he_dev->rbpl_virt);
kfree(he_dev->rbpl_table); bitmap_free(he_dev->rbpl_table);
dma_pool_destroy(he_dev->rbpl_pool); dma_pool_destroy(he_dev->rbpl_pool);
if (he_dev->rbrq_base) if (he_dev->rbrq_base)
......
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