mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
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>
This commit is contained in:
parent
ecd68ef8d9
commit
81ff48ddda
1 changed files with 2 additions and 4 deletions
|
@ -555,7 +555,7 @@ skip_ctx_setup:
|
||||||
|
|
||||||
void bnxt_qplib_free_rcfw_channel(struct bnxt_qplib_rcfw *rcfw)
|
void bnxt_qplib_free_rcfw_channel(struct bnxt_qplib_rcfw *rcfw)
|
||||||
{
|
{
|
||||||
kfree(rcfw->cmdq.cmdq_bitmap);
|
bitmap_free(rcfw->cmdq.cmdq_bitmap);
|
||||||
kfree(rcfw->qp_tbl);
|
kfree(rcfw->qp_tbl);
|
||||||
kfree(rcfw->crsqe_tbl);
|
kfree(rcfw->crsqe_tbl);
|
||||||
bnxt_qplib_free_hwq(rcfw->res, &rcfw->cmdq.hwq);
|
bnxt_qplib_free_hwq(rcfw->res, &rcfw->cmdq.hwq);
|
||||||
|
@ -572,7 +572,6 @@ int bnxt_qplib_alloc_rcfw_channel(struct bnxt_qplib_res *res,
|
||||||
struct bnxt_qplib_sg_info sginfo = {};
|
struct bnxt_qplib_sg_info sginfo = {};
|
||||||
struct bnxt_qplib_cmdq_ctx *cmdq;
|
struct bnxt_qplib_cmdq_ctx *cmdq;
|
||||||
struct bnxt_qplib_creq_ctx *creq;
|
struct bnxt_qplib_creq_ctx *creq;
|
||||||
u32 bmap_size = 0;
|
|
||||||
|
|
||||||
rcfw->pdev = res->pdev;
|
rcfw->pdev = res->pdev;
|
||||||
cmdq = &rcfw->cmdq;
|
cmdq = &rcfw->cmdq;
|
||||||
|
@ -613,8 +612,7 @@ int bnxt_qplib_alloc_rcfw_channel(struct bnxt_qplib_res *res,
|
||||||
if (!rcfw->crsqe_tbl)
|
if (!rcfw->crsqe_tbl)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
bmap_size = BITS_TO_LONGS(rcfw->cmdq_depth) * sizeof(unsigned long);
|
cmdq->cmdq_bitmap = bitmap_zalloc(rcfw->cmdq_depth, GFP_KERNEL);
|
||||||
cmdq->cmdq_bitmap = kzalloc(bmap_size, GFP_KERNEL);
|
|
||||||
if (!cmdq->cmdq_bitmap)
|
if (!cmdq->cmdq_bitmap)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue