Skip to contentSkip to conversation

RDMA: fix allocation failure on pointer pd

PATCH Applied Colin King 3 participants 3 messages Feb 12, 2019

Subsystems (3)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 RDMA: fix allocation failure on pointer pd

From: Colin Ian King <[email protected]>

The null check on an allocation failure on pd is currently checking if pd is non-null rather than null. Fix this by adding the missing ! operator.

Fixes 21a428a019c9 ("RDMA: Handle PD allocations by IB/core")
---
 drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/hns/hns_roce_hw_v1.c +1 -1
index a18b88c95995..77c3678f4829 100644
@@ -745,7 +745,7 @@ static int hns_roce_v1_rsv_lp_qp(struct hns_roce_dev *hr_dev)
 
 	ibdev = &hr_dev->ib_dev;
 	pd = rdma_zalloc_drv_obj(ibdev, ib_pd);
-	if (pd)
+	if (!pd)
 		goto alloc_mem_failed;
 
 	pd->device  = ibdev;
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Colin King

From: Colin Ian King <[email protected]>

The null check on an allocation failure on pd is currently checking if pd is non-null rather than null. Fix this by adding the missing ! operator.

Quoted 6 lines
Fixes 21a428a019c9 ("RDMA: Handle PD allocations by IB/core")
---
 drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Thanks a lot,

#2 lore raw
In reply to Colin King
Quoted 6 lines · Colin King

From: Colin Ian King <[email protected]>

The null check on an allocation failure on pd is currently checking if pd is non-null rather than null. Fix this by adding the missing ! operator.

Quoted 6 lines
Fixes 21a428a019c9 ("RDMA: Handle PD allocations by IB/core")
---
 drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Thanks applied to for-next

Regards,
Jason