Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Christophe JAILLET and committed by
Jakub Kicinski
9e433ac1 2b8bf3d6

+3 -6
+3 -6
drivers/atm/he.c
··· 780 780 G0_RBPS_BS + (group * 32)); 781 781 782 782 /* bitmap table */ 783 - he_dev->rbpl_table = kmalloc_array(BITS_TO_LONGS(RBPL_TABLE_SIZE), 784 - sizeof(*he_dev->rbpl_table), 785 - GFP_KERNEL); 783 + he_dev->rbpl_table = bitmap_zalloc(RBPL_TABLE_SIZE, GFP_KERNEL); 786 784 if (!he_dev->rbpl_table) { 787 785 hprintk("unable to allocate rbpl bitmap table\n"); 788 786 return -ENOMEM; 789 787 } 790 - bitmap_zero(he_dev->rbpl_table, RBPL_TABLE_SIZE); 791 788 792 789 /* rbpl_virt 64-bit pointers */ 793 790 he_dev->rbpl_virt = kmalloc_array(RBPL_TABLE_SIZE, ··· 899 902 out_free_rbpl_virt: 900 903 kfree(he_dev->rbpl_virt); 901 904 out_free_rbpl_table: 902 - kfree(he_dev->rbpl_table); 905 + bitmap_free(he_dev->rbpl_table); 903 906 904 907 return -ENOMEM; 905 908 } ··· 1575 1578 } 1576 1579 1577 1580 kfree(he_dev->rbpl_virt); 1578 - kfree(he_dev->rbpl_table); 1581 + bitmap_free(he_dev->rbpl_table); 1579 1582 dma_pool_destroy(he_dev->rbpl_pool); 1580 1583 1581 1584 if (he_dev->rbrq_base)