RDMA/ocrdma: Fix an error code in ocrdma_alloc_pd()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 13 Jul 2017 07:46:14 +0000 (10:46 +0300)
committerDoug Ledford <dledford@redhat.com>
Thu, 20 Jul 2017 15:20:49 +0000 (11:20 -0400)
We should preserve the original "status" error code instead of resetting
it to zero.  Returning ERR_PTR(0) is the same as NULL and results in a
NULL dereference in the callers.  I added a printk() on error instead.

Fixes: 45e86b33ec8b ("RDMA/ocrdma: Cache recv DB until QP moved to RTR")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c

index 2f30bda8457a9acea831e0991ff648ba8ec44c44..cc317e858040886980412c2898f3f1d94961f92e 100644 (file)
@@ -744,7 +744,8 @@ err:
        if (is_uctx_pd) {
                ocrdma_release_ucontext_pd(uctx);
        } else {
-               status = _ocrdma_dealloc_pd(dev, pd);
+               if (_ocrdma_dealloc_pd(dev, pd))
+                       pr_err("%s: _ocrdma_dealloc_pd() failed\n", __func__);
        }
 exit:
        return ERR_PTR(status);