__get_txreq() returns an ERR_PTR() but this checks for NULL so it would
oops on failure.

Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com>

diff --git a/drivers/staging/rdma/hfi1/verbs.c 
b/drivers/staging/rdma/hfi1/verbs.c
index 53ac214..41bb59e 100644
--- a/drivers/staging/rdma/hfi1/verbs.c
+++ b/drivers/staging/rdma/hfi1/verbs.c
@@ -749,11 +749,13 @@ static inline struct verbs_txreq *get_txreq(struct 
hfi1_ibdev *dev,
        struct verbs_txreq *tx;
 
        tx = kmem_cache_alloc(dev->verbs_txreq_cache, GFP_ATOMIC);
-       if (!tx)
+       if (!tx) {
                /* call slow path to get the lock */
                tx =  __get_txreq(dev, qp);
-       if (tx)
-               tx->qp = qp;
+               if (IS_ERR(tx))
+                       return tx;
+       }
+       tx->qp = qp;
        return tx;
 }
 
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to