RDMA/irdma: Propagate error codes
authorShiraz Saleem <shiraz.saleem@intel.com>
Thu, 17 Feb 2022 15:18:50 +0000 (09:18 -0600)
committerJason Gunthorpe <jgg@nvidia.com>
Wed, 23 Feb 2022 19:24:18 +0000 (15:24 -0400)
All functions now return linux error codes. Propagate the return from
these functions as opposed to converting them to generic values.

Link: https://lore.kernel.org/r/20220217151851.1518-3-shiraz.saleem@intel.com
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/irdma/hw.c
drivers/infiniband/hw/irdma/main.c
drivers/infiniband/hw/irdma/verbs.c

index cd0d409844f191c644647ca65154387820793742..93b71357ba98f2250135ad8bf64a70ba58f5373b 100644 (file)
@@ -1099,7 +1099,7 @@ static int irdma_cfg_ceq_vector(struct irdma_pci_f *rf, struct irdma_ceq *iwceq,
        irq_update_affinity_hint(msix_vec->irq, &msix_vec->mask);
        if (status) {
                ibdev_dbg(&rf->iwdev->ibdev, "ERR: ceq irq config fail\n");
-               return -EINVAL;
+               return status;
        }
 
        msix_vec->ceq_id = ceq_id;
index 6558d5e1ade5789259a61324f4cf9d72a1253d55..babbe8ad5afa00478fb0d25641e1ffa7ed34ea06 100644 (file)
@@ -176,7 +176,7 @@ static int irdma_lan_register_qset(struct irdma_sc_vsi *vsi,
        ret = ice_add_rdma_qset(pf, &qset);
        if (ret) {
                ibdev_dbg(&iwdev->ibdev, "WS: LAN alloc_res for rdma qset failed.\n");
-               return -EINVAL;
+               return ret;
        }
 
        tc_node->l2_sched_node_id = qset.teid;
@@ -280,10 +280,9 @@ static int irdma_probe(struct auxiliary_device *aux_dev, const struct auxiliary_
        irdma_fill_device_info(iwdev, pf, vsi);
        rf = iwdev->rf;
 
-       if (irdma_ctrl_init_hw(rf)) {
-               err = -EIO;
+       err = irdma_ctrl_init_hw(rf);
+       if (err)
                goto err_ctrl_init;
-       }
 
        l2params.mtu = iwdev->netdev->mtu;
        ice_get_qos_params(pf, &qos_info);
@@ -291,10 +290,9 @@ static int irdma_probe(struct auxiliary_device *aux_dev, const struct auxiliary_
        if (iwdev->rf->protocol_used != IRDMA_IWARP_PROTOCOL_ONLY)
                iwdev->dcb_vlan_mode = l2params.num_tc > 1 && !l2params.dscp_mode;
 
-       if (irdma_rt_init_hw(iwdev, &l2params)) {
-               err = -EIO;
+       err = irdma_rt_init_hw(iwdev, &l2params);
+       if (err)
                goto err_rt_init;
-       }
 
        err = irdma_ib_register_device(iwdev);
        if (err)
index 6ab56a2f6a23a60c3a14c4eedf4ca9dbc48f5964..3a5f41b4fd5b9d334ce863ed9c5a2e7cb8186147 100644 (file)
@@ -603,7 +603,7 @@ static int irdma_setup_kmode_qp(struct irdma_device *iwdev,
        status = irdma_get_sqdepth(uk_attrs, ukinfo->sq_size, sqshift,
                                   &sqdepth);
        if (status)
-               return -ENOMEM;
+               return status;
 
        if (uk_attrs->hw_rev == IRDMA_GEN_1)
                rqshift = IRDMA_MAX_RQ_WQE_SHIFT_GEN1;
@@ -614,7 +614,7 @@ static int irdma_setup_kmode_qp(struct irdma_device *iwdev,
        status = irdma_get_rqdepth(uk_attrs, ukinfo->rq_size, rqshift,
                                   &rqdepth);
        if (status)
-               return -ENOMEM;
+               return status;
 
        iwqp->kqp.sq_wrid_mem =
                kcalloc(sqdepth, sizeof(*iwqp->kqp.sq_wrid_mem), GFP_KERNEL);
@@ -688,7 +688,7 @@ static int irdma_cqp_create_qp_cmd(struct irdma_qp *iwqp)
        status = irdma_handle_cqp_op(rf, cqp_request);
        irdma_put_cqp_request(&rf->cqp, cqp_request);
 
-       return status ? -ENOMEM : 0;
+       return status;
 }
 
 static void irdma_roce_fill_and_set_qpctx_info(struct irdma_qp *iwqp,
@@ -2316,7 +2316,7 @@ static int irdma_setup_pbles(struct irdma_pci_f *rf, struct irdma_mr *iwmr,
                status = irdma_get_pble(rf->pble_rsrc, palloc, iwmr->page_cnt,
                                        false);
                if (status)
-                       return -ENOMEM;
+                       return status;
 
                iwpbl->pbl_allocated = true;
                level = palloc->level;
@@ -2457,7 +2457,7 @@ static int irdma_hw_alloc_mw(struct irdma_device *iwdev, struct irdma_mr *iwmr)
        status = irdma_handle_cqp_op(iwdev->rf, cqp_request);
        irdma_put_cqp_request(&iwdev->rf->cqp, cqp_request);
 
-       return status ? -ENOMEM : 0;
+       return status;
 }
 
 /**
@@ -3553,7 +3553,7 @@ error:
        ibdev_dbg(&iwdev->ibdev, "%s: Error polling CQ, irdma_err: %d\n",
                  __func__, ret);
 
-       return -EINVAL;
+       return ret;
 }
 
 /**
@@ -3873,10 +3873,8 @@ static int irdma_mcast_cqp_op(struct irdma_device *iwdev,
        cqp_info->in.u.mc_create.cqp = &iwdev->rf->cqp.sc_cqp;
        status = irdma_handle_cqp_op(iwdev->rf, cqp_request);
        irdma_put_cqp_request(&iwdev->rf->cqp, cqp_request);
-       if (status)
-               return -ENOMEM;
 
-       return 0;
+       return status;
 }
 
 /**