RDMA/hns: Return correct error code from hns_roce_v1_rsv_lp_qp()
authorLijun Ou <oulijun@huawei.com>
Wed, 25 Jul 2018 07:29:36 +0000 (15:29 +0800)
committerJason Gunthorpe <jgg@mellanox.com>
Thu, 26 Jul 2018 22:51:12 +0000 (16:51 -0600)
When create loop qp fail, it will return the correct result when
modify_qp() fails.

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/hns/hns_roce_hw_v1.c

index 783d28d..ae6b642 100644 (file)
@@ -785,6 +785,7 @@ static int hns_roce_v1_rsv_lp_qp(struct hns_roce_dev *hr_dev)
                free_mr->mr_free_qp[i] = hns_roce_v1_create_lp_qp(hr_dev, pd);
                if (!free_mr->mr_free_qp[i]) {
                        dev_err(dev, "Create loop qp failed!\n");
+                       ret = -ENOMEM;
                        goto create_lp_qp_failed;
                }
                hr_qp = free_mr->mr_free_qp[i];
@@ -854,7 +855,7 @@ alloc_pd_failed:
        if (hns_roce_ib_destroy_cq(cq))
                dev_err(dev, "Destroy cq for create_lp_qp failed!\n");
 
-       return -EINVAL;
+       return ret;
 }
 
 static void hns_roce_v1_release_lp_qp(struct hns_roce_dev *hr_dev)