Skip to content

Commit

Permalink
IB/hfi1: checking for NULL instead of IS_ERR
Browse files Browse the repository at this point in the history
__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>
  • Loading branch information
Dan Carpenter authored and Doug Ledford committed Sep 18, 2015
1 parent aeef010 commit 50b1972
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/staging/rdma/hfi1/verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 50b1972

Please sign in to comment.