RDMA: Fix allocation failure on pointer pd
authorColin Ian King <colin.king@canonical.com>
Tue, 12 Feb 2019 11:22:33 +0000 (11:22 +0000)
committerJason Gunthorpe <jgg@mellanox.com>
Wed, 13 Feb 2019 16:00:43 +0000 (09:00 -0700)
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")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/hns/hns_roce_hw_v1.c

index c8c90072baddd49eff641c7412bde42c2f33688e..97515c340134c6514f92ad56276ed2d2b361d420 100644 (file)
@@ -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;