Skip to content

Commit

Permalink
qed: Use the bitmap API to allocate bitmaps
Browse files Browse the repository at this point in the history
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/d61ec77ce0b92f7539c6a144106139f8d737ec29.1657053343.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Christophe JAILLET authored and Jakub Kicinski committed Jul 7, 2022
1 parent 76d3c11 commit 291dbea
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/net/ethernet/qlogic/qed/qed_rdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ int qed_rdma_bmap_alloc(struct qed_hwfn *p_hwfn,

bmap->max_count = max_count;

bmap->bitmap = kcalloc(BITS_TO_LONGS(max_count), sizeof(long),
GFP_KERNEL);
bmap->bitmap = bitmap_zalloc(max_count, GFP_KERNEL);
if (!bmap->bitmap)
return -ENOMEM;

Expand Down Expand Up @@ -343,7 +342,7 @@ void qed_rdma_bmap_free(struct qed_hwfn *p_hwfn,
}

end:
kfree(bmap->bitmap);
bitmap_free(bmap->bitmap);
bmap->bitmap = NULL;
}

Expand Down

0 comments on commit 291dbea

Please sign in to comment.