{
        struct hns_roce_cq *send_cq, *recv_cq;
        struct ib_device *ibdev = &hr_dev->ib_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)
                        ibdev_err(ibdev, "modify QP to Reset failed.\n");
-                       return ret;
-               }
        }
 
        send_cq = to_hr_cq(hr_qp->ibqp.send_cq);
                kfree(hr_qp->rq_inl_buf.wqe_list);
        }
 
-       return 0;
+       return ret;
 }
 
 static int hns_roce_v2_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata)
        int ret;
 
        ret = hns_roce_v2_destroy_qp_common(hr_dev, hr_qp, udata);
-       if (ret) {
+       if (ret)
                ibdev_err(&hr_dev->ib_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));