linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] IB/hfi1: checking for NULL instead of IS_ERR
@ 2015-09-16  6:22 Dan Carpenter
  2015-09-18 15:51 ` Doug Ledford
  0 siblings, 1 reply; 9+ messages in thread
From: Dan Carpenter @ 2015-09-16  6:22 UTC (permalink / raw)
  To: Mike Marciniszyn
  Cc: Doug Ledford, Sean Hefty, Hal Rosenstock, Greg Kroah-Hartman,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

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

Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-09-21 22:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-16  6:22 [patch] IB/hfi1: checking for NULL instead of IS_ERR Dan Carpenter
2015-09-18 15:51 ` Doug Ledford
2015-09-19  3:01   ` Greg Kroah-Hartman
     [not found]     ` <20150919030153.GA30373-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2015-09-19 22:49       ` Weiny, Ira
     [not found]         ` <2807E5FD2F6FDA4886F6618EAC48510E1CB98D06-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-09-20 17:26           ` Greg Kroah-Hartman
2015-09-21 15:42     ` Doug Ledford
2015-09-21 16:48       ` Greg Kroah-Hartman
     [not found]         ` <20150921164846.GB27380-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2015-09-21 17:03           ` Doug Ledford
     [not found]             ` <56003878.7080409-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-09-21 22:29               ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).