Skip to content

Commit 29e00ce

Browse files
author
Nilesh Javali
committed
cnic: Use the bitmap API to allocate bitmaps
Bugzilla: https://bugzilla.redhat.com/2164967 Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git commit 76d3c11 Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Date: Tue Jul 5 22:25:58 2022 +0200 cnic: 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/521bd2a49be5d88e493bcfb63505d3df91a1c2d2.1657052743.git.christophe.jaillet@wanadoo.fr Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Nilesh Javali <njavali@redhat.com>
1 parent c4f8ceb commit 29e00ce

File tree

1 file changed

+2
-2
lines changed
  • drivers/net/ethernet/broadcom

1 file changed

+2
-2
lines changed

drivers/net/ethernet/broadcom/cnic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ static int cnic_init_id_tbl(struct cnic_id_tbl *id_tbl, u32 size, u32 start_id,
660660
id_tbl->max = size;
661661
id_tbl->next = next;
662662
spin_lock_init(&id_tbl->lock);
663-
id_tbl->table = kcalloc(BITS_TO_LONGS(size), sizeof(long), GFP_KERNEL);
663+
id_tbl->table = bitmap_zalloc(size, GFP_KERNEL);
664664
if (!id_tbl->table)
665665
return -ENOMEM;
666666

@@ -669,7 +669,7 @@ static int cnic_init_id_tbl(struct cnic_id_tbl *id_tbl, u32 size, u32 start_id,
669669

670670
static void cnic_free_id_tbl(struct cnic_id_tbl *id_tbl)
671671
{
672-
kfree(id_tbl->table);
672+
bitmap_free(id_tbl->table);
673673
id_tbl->table = NULL;
674674
}
675675

0 commit comments

Comments
 (0)