Skip to content

Commit ff784bd

Browse files
committed
RDMA/bnxt_re: Use bitmap_zalloc() when applicable
Bugzilla: https://bugzilla.redhat.com/2142686 commit 81ff48d Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Date: Thu Nov 25 21:42:28 2021 +0100 RDMA/bnxt_re: Use bitmap_zalloc() when applicable Use 'bitmap_zalloc()' to simplify code, improve the semantic and avoid some open-coded arithmetic in allocator arguments. Also change the corresponding 'kfree()' into 'bitmap_free()' to keep consistency. Link: https://lore.kernel.org/r/5c029daf43b92fdc27926fe8a98084843437c498.1637872888.git.christophe.jaillet@wanadoo.fr Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Kamal Heib <kheib@redhat.com>
1 parent 5ee0b09 commit ff784bd

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/infiniband/hw/bnxt_re/qplib_rcfw.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw,
555555

556556
void bnxt_qplib_free_rcfw_channel(struct bnxt_qplib_rcfw *rcfw)
557557
{
558-
kfree(rcfw->cmdq.cmdq_bitmap);
558+
bitmap_free(rcfw->cmdq.cmdq_bitmap);
559559
kfree(rcfw->qp_tbl);
560560
kfree(rcfw->crsqe_tbl);
561561
bnxt_qplib_free_hwq(rcfw->res, &rcfw->cmdq.hwq);
@@ -572,7 +572,6 @@ int bnxt_qplib_alloc_rcfw_channel(struct bnxt_qplib_res *res,
572572
struct bnxt_qplib_sg_info sginfo = {};
573573
struct bnxt_qplib_cmdq_ctx *cmdq;
574574
struct bnxt_qplib_creq_ctx *creq;
575-
u32 bmap_size = 0;
576575

577576
rcfw->pdev = res->pdev;
578577
cmdq = &rcfw->cmdq;
@@ -613,8 +612,7 @@ int bnxt_qplib_alloc_rcfw_channel(struct bnxt_qplib_res *res,
613612
if (!rcfw->crsqe_tbl)
614613
goto fail;
615614

616-
bmap_size = BITS_TO_LONGS(rcfw->cmdq_depth) * sizeof(unsigned long);
617-
cmdq->cmdq_bitmap = kzalloc(bmap_size, GFP_KERNEL);
615+
cmdq->cmdq_bitmap = bitmap_zalloc(rcfw->cmdq_depth, GFP_KERNEL);
618616
if (!cmdq->cmdq_bitmap)
619617
goto fail;
620618

0 commit comments

Comments
 (0)