Skip to content

Commit d24b923

Browse files
Dan Carpenterrleon
authored andcommitted
RDMA/bnxt_re: Fix error code in bnxt_re_create_cq()
Return -ENOMEM if get_zeroed_page() fails. Don't return success. Fixes: e275919 ("RDMA/bnxt_re: Share a page to expose per CQ info with userspace") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dan Carpenter <[email protected]> Acked-by: Selvin Xavier <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 2307157 commit d24b923

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/infiniband/hw/bnxt_re/ib_verbs.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2944,9 +2944,9 @@ int bnxt_re_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
29442944
struct bnxt_qplib_dev_attr *dev_attr = &rdev->dev_attr;
29452945
struct bnxt_qplib_chip_ctx *cctx;
29462946
struct bnxt_qplib_nq *nq = NULL;
2947-
int rc = -ENOMEM, entries;
29482947
unsigned int nq_alloc_cnt;
29492948
int cqe = attr->cqe;
2949+
int rc, entries;
29502950
u32 active_cqs;
29512951

29522952
if (attr->flags)
@@ -3027,8 +3027,10 @@ int bnxt_re_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
30273027
hash_add(rdev->cq_hash, &cq->hash_entry, cq->qplib_cq.id);
30283028
/* Allocate a page */
30293029
cq->uctx_cq_page = (void *)get_zeroed_page(GFP_KERNEL);
3030-
if (!cq->uctx_cq_page)
3030+
if (!cq->uctx_cq_page) {
3031+
rc = -ENOMEM;
30313032
goto c2fail;
3033+
}
30323034
resp.comp_mask |= BNXT_RE_CQ_TOGGLE_PAGE_SUPPORT;
30333035
}
30343036
resp.cqid = cq->qplib_cq.id;

0 commit comments

Comments
 (0)