summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2015-09-16 08:22:20 +0200
committerDoug Ledford <dledford@redhat.com>2015-09-18 17:28:47 +0200
commit50b19729ced72cfa8bb1c44fed9203f395f13991 (patch)
tree58b03546dcd209e395713089beb881e69e1ddbdc
parentIB/hfi1: fix sdma_descq_cnt parameter parsing (diff)
downloadlinux-50b19729ced72cfa8bb1c44fed9203f395f13991.tar.xz
linux-50b19729ced72cfa8bb1c44fed9203f395f13991.zip
IB/hfi1: checking for NULL instead of IS_ERR
__get_txreq() returns an ERR_PTR() but this checks for NULL so it would oops on failure. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--drivers/staging/rdma/hfi1/verbs.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/staging/rdma/hfi1/verbs.c b/drivers/staging/rdma/hfi1/verbs.c
index 53ac21431542..41bb59eb001c 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;
}