Skip to contentSkip to conversation

RDMA/hns: Fix error return code in hns_roce_v1_rsv_lp_qp()

PATCH Applied Wei Yongjun 3 participants 3 messages Aug 1, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/hns: Fix error return code in hns_roce_v1_rsv_lp_qp()

Fix to return error code -ENOMEM from the rdma_zalloc_drv_obj() error handling case instead of 0, as done elsewhere in this function.

Fixes e8ac9389f0d7 ("RDMA: Fix allocation failure on pointer pd")
Fixes 21a428a019c9 ("RDMA: Handle PD allocations by IB/core")
---
 drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/hns/hns_roce_hw_v1.c +3 -1
index 70583f82e290..aa8a660ffcda 100644
@@ -750,8 +750,10 @@ static int hns_roce_v1_rsv_lp_qp(struct hns_roce_dev *hr_dev)
 	atomic_set(&free_mr->mr_free_cq->ib_cq.usecnt, 0);
 
 	pd = rdma_zalloc_drv_obj(ibdev, ib_pd);
-	if (!pd)
+	if (!pd) {
+		ret = -ENOMEM;
 		goto alloc_mem_failed;
+	}
 
 	pd->device  = ibdev;
 	ret = hns_roce_alloc_pd(pd, NULL);
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Wei Yongjun

Fix to return error code -ENOMEM from the rdma_zalloc_drv_obj() error handling case instead of 0, as done elsewhere in this function.

Fixes e8ac9389f0d7 ("RDMA: Fix allocation failure on pointer pd")
Fixes 21a428a019c9 ("RDMA: Handle PD allocations by IB/core")
---
 drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Thanks,

Applied
#2 lore raw
In reply to Wei Yongjun
Quoted 6 lines · Wei Yongjun

Fix to return error code -ENOMEM from the rdma_zalloc_drv_obj() error handling case instead of 0, as done elsewhere in this function.

Fixes e8ac9389f0d7 ("RDMA: Fix allocation failure on pointer pd")
Fixes 21a428a019c9 ("RDMA: Handle PD allocations by IB/core")

Thanks, applied to for-rc.

Signature · 3 lines
Doug Ledford <[email protected]>
    GPG KeyID: B826A3330E572FDD
    Fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD