@@ -431,7 +431,7 @@ enum irdma_status_code irdma_sc_qp_create(struct irdma_sc_qp *qp, struct irdma_c
cqp = qp->dev->cqp;
if (qp->qp_uk.qp_id < cqp->dev->hw_attrs.min_hw_qp_id ||
- qp->qp_uk.qp_id > (cqp->dev->hmc_info->hmc_obj[IRDMA_HMC_IW_QP].max_cnt - 1))
+ qp->qp_uk.qp_id >= (cqp->dev->hmc_info->hmc_obj[IRDMA_HMC_IW_QP].max_cnt))
return IRDMA_ERR_INVALID_QP_ID;
wqe = irdma_sc_cqp_get_next_send_wqe(cqp, scratch);
@@ -2510,10 +2510,10 @@ static enum irdma_status_code irdma_sc_cq_create(struct irdma_sc_cq *cq,
enum irdma_status_code ret_code = 0;
cqp = cq->dev->cqp;
- if (cq->cq_uk.cq_id > (cqp->dev->hmc_info->hmc_obj[IRDMA_HMC_IW_CQ].max_cnt - 1))
+ if (cq->cq_uk.cq_id >= (cqp->dev->hmc_info->hmc_obj[IRDMA_HMC_IW_CQ].max_cnt))
return IRDMA_ERR_INVALID_CQ_ID;
- if (cq->ceq_id > (cq->dev->hmc_fpm_misc.max_ceqs - 1))
+ if (cq->ceq_id >= (cq->dev->hmc_fpm_misc.max_ceqs))
return IRDMA_ERR_INVALID_CEQ_ID;
ceq = cq->dev->ceq[cq->ceq_id];
@@ -3615,7 +3615,7 @@ enum irdma_status_code irdma_sc_ceq_init(struct irdma_sc_ceq *ceq,
info->elem_cnt > info->dev->hw_attrs.max_hw_ceq_size)
return IRDMA_ERR_INVALID_SIZE;
- if (info->ceq_id > (info->dev->hmc_fpm_misc.max_ceqs - 1))
+ if (info->ceq_id >= (info->dev->hmc_fpm_misc.max_ceqs))
return IRDMA_ERR_INVALID_CEQ_ID;
pble_obj_cnt = info->dev->hmc_info->hmc_obj[IRDMA_HMC_IW_PBLE].cnt;
@@ -4164,7 +4164,7 @@ enum irdma_status_code irdma_sc_ccq_init(struct irdma_sc_cq *cq,
info->num_elem > info->dev->hw_attrs.uk_attrs.max_hw_cq_size)
return IRDMA_ERR_INVALID_SIZE;
- if (info->ceq_id > (info->dev->hmc_fpm_misc.max_ceqs - 1))
+ if (info->ceq_id >= (info->dev->hmc_fpm_misc.max_ceqs ))
return IRDMA_ERR_INVALID_CEQ_ID;
pble_obj_cnt = info->dev->hmc_info->hmc_obj[IRDMA_HMC_IW_PBLE].cnt;