diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c index 6b433b453490066d1e448167ac238749e3bbe090..c679be7c72f34679701ee76cc0e92e070c41839c 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -5143,18 +5143,16 @@ static int hns_roce_v2_destroy_qp_common(struct hns_roce_dev *hr_dev, { struct hns_roce_cq *send_cq, *recv_cq; struct device *dev = hr_dev->dev; - int ret; + int ret = 0; if (hr_qp->ibqp.qp_type == IB_QPT_RC && hr_qp->state != IB_QPS_RESET) { /* Modify qp to reset before destroying qp */ ret = hns_roce_v2_modify_qp(&hr_qp->ibqp, NULL, 0, hr_qp->state, IB_QPS_RESET); - if (ret) { + if (ret) dev_err(dev, "modify QP %06lx to Reset failed, ret = %d.\n", hr_qp->qpn, ret); - return ret; - } } hns_roce_get_cqs(&hr_qp->ibqp, &send_cq, &recv_cq); @@ -5209,7 +5207,7 @@ static int hns_roce_v2_destroy_qp_common(struct hns_roce_dev *hr_dev, kfree(hr_qp->rq_inl_buf.wqe_list); } - return 0; + return ret; } static int hns_roce_v2_destroy_qp(struct ib_qp *ibqp) @@ -5224,18 +5222,16 @@ static int hns_roce_v2_destroy_qp(struct ib_qp *ibqp) hns_roce_inc_rdma_hw_stats(ibqp->device, HW_STATS_QP_DEALLOC); ret = hns_roce_v2_destroy_qp_common(hr_dev, hr_qp, !!ibqp->pd->uobject); - if (ret) { + if (ret) dev_err(hr_dev->dev, "Destroy qp 0x%06lx failed(%d)\n", hr_qp->qpn, ret); - return ret; - } if (hr_qp->ibqp.qp_type == IB_QPT_GSI) kfree(hr_to_hr_sqp(hr_qp)); else kfree(hr_qp); - return 0; + return ret; } static int hns_roce_v2_qp_flow_control_init(struct hns_roce_dev *hr_dev,