diff mbox series

scsi: qedi: Use the bitmap API to allocate bitmaps

Message ID ff249726a25755d4ae5e1099b04712fe79df7672.1656963540.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State Deferred
Headers show
Series scsi: qedi: Use the bitmap API to allocate bitmaps | expand

Commit Message

Christophe JAILLET July 4, 2022, 7:39 p.m. UTC
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>
---
 drivers/scsi/qedi/qedi_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
index cecfb2cb4c7b..06c7dd620b46 100644
--- a/drivers/scsi/qedi/qedi_main.c
+++ b/drivers/scsi/qedi/qedi_main.c
@@ -535,7 +535,7 @@  static int qedi_init_id_tbl(struct qedi_portid_tbl *id_tbl, u16 size,
 	id_tbl->max = size;
 	id_tbl->next = next;
 	spin_lock_init(&id_tbl->lock);
-	id_tbl->table = kcalloc(BITS_TO_LONGS(size), sizeof(long), GFP_KERNEL);
+	id_tbl->table = bitmap_zalloc(size, GFP_KERNEL);
 	if (!id_tbl->table)
 		return -ENOMEM;
 
@@ -544,7 +544,7 @@  static int qedi_init_id_tbl(struct qedi_portid_tbl *id_tbl, u16 size,
 
 static void qedi_free_id_tbl(struct qedi_portid_tbl *id_tbl)
 {
-	kfree(id_tbl->table);
+	bitmap_free(id_tbl->table);
 	id_tbl->table = NULL;
 }