@@ -3377,18 +3377,15 @@ int bnxt_re_create_user_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *att
33773377 struct bnxt_qplib_chip_ctx * cctx ;
33783378 struct bnxt_re_cq_resp resp = {};
33793379 struct bnxt_re_cq_req req ;
3380- int cqe = attr -> cqe ;
33813380 int rc ;
33823381 u32 active_cqs , entries ;
33833382
33843383 if (attr -> flags )
33853384 return - EOPNOTSUPP ;
33863385
33873386 /* Validate CQ fields */
3388- if (cqe < 1 || cqe > dev_attr -> max_cq_wqes ) {
3389- ibdev_err (& rdev -> ibdev , "Failed to create CQ -max exceeded" );
3387+ if (attr -> cqe > dev_attr -> max_cq_wqes )
33903388 return - EINVAL ;
3391- }
33923389
33933390 cq -> rdev = rdev ;
33943391 cctx = rdev -> chip_ctx ;
@@ -3409,15 +3406,13 @@ int bnxt_re_create_user_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *att
34093406 ibcq -> umem = ib_umem_get (& rdev -> ibdev , req .cq_va ,
34103407 entries * sizeof (struct cq_base ),
34113408 IB_ACCESS_LOCAL_WRITE );
3412- if (IS_ERR (ibcq -> umem )) {
3413- rc = PTR_ERR (ibcq -> umem );
3414- goto fail ;
3415- }
3409+ if (IS_ERR (ibcq -> umem ))
3410+ return PTR_ERR (ibcq -> umem );
34163411 }
34173412
34183413 rc = bnxt_re_setup_sginfo (rdev , ibcq -> umem , & cq -> qplib_cq .sg_info );
34193414 if (rc )
3420- goto fail ;
3415+ return rc ;
34213416
34223417 cq -> qplib_cq .dpi = & uctx -> dpi ;
34233418 cq -> qplib_cq .max_wqe = entries ;
@@ -3426,10 +3421,8 @@ int bnxt_re_create_user_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *att
34263421 cq -> qplib_cq .cnq_hw_ring_id = cq -> qplib_cq .nq -> ring_id ;
34273422
34283423 rc = bnxt_qplib_create_cq (& rdev -> qplib_res , & cq -> qplib_cq );
3429- if (rc ) {
3430- ibdev_err (& rdev -> ibdev , "Failed to create HW CQ" );
3431- goto fail ;
3432- }
3424+ if (rc )
3425+ return rc ;
34333426
34343427 cq -> ib_cq .cqe = entries ;
34353428 cq -> cq_period = cq -> qplib_cq .period ;
@@ -3442,16 +3435,14 @@ int bnxt_re_create_user_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *att
34423435 hash_add (rdev -> cq_hash , & cq -> hash_entry , cq -> qplib_cq .id );
34433436 /* Allocate a page */
34443437 cq -> uctx_cq_page = (void * )get_zeroed_page (GFP_KERNEL );
3445- if (!cq -> uctx_cq_page ) {
3446- rc = - ENOMEM ;
3447- goto fail ;
3448- }
3438+ if (!cq -> uctx_cq_page )
3439+ return - ENOMEM ;
3440+
34493441 resp .comp_mask |= BNXT_RE_CQ_TOGGLE_PAGE_SUPPORT ;
34503442 }
34513443 resp .cqid = cq -> qplib_cq .id ;
34523444 resp .tail = cq -> qplib_cq .hwq .cons ;
34533445 resp .phase = cq -> qplib_cq .period ;
3454- resp .rsvd = 0 ;
34553446 rc = ib_respond_udata (udata , resp );
34563447 if (rc ) {
34573448 bnxt_qplib_destroy_cq (& rdev -> qplib_res , & cq -> qplib_cq );
@@ -3462,7 +3453,6 @@ int bnxt_re_create_user_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *att
34623453
34633454free_mem :
34643455 free_page ((unsigned long )cq -> uctx_cq_page );
3465- fail :
34663456 return rc ;
34673457}
34683458
0 commit comments