Skip to contentSkip to conversation

IB/rdmavt: Correct qp_priv_alloc() return value test

PATCH Applied Dennis Dalessandro 2 participants 2 messages Jun 22, 2016 – Jun 23, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IB/rdmavt: Correct qp_priv_alloc() return value test

From: Mike Marciniszyn <[email protected]>

The current drivers return errors from this calldown wrapped in an ERR_PTR().

The rdmavt code incorrectly tests for NULL.

The code is fixed to use IS_ERR() and change ret according to the driver return value.

---
 drivers/infiniband/sw/rdmavt/qp.c |    4 +++-
 include/rdma/rdma_vt.h            |    4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/infiniband/sw/rdmavt/qp.c +3 -1
index d04f4fe..41ba7e9 100644
@@ -699,8 +699,10 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
 		 * initialization that is needed.
 		 */
 		priv = rdi->driver_f.qp_priv_alloc(rdi, qp, gfp);
-		if (!priv)
+		if (IS_ERR(priv)) {
+			ret = priv;
 			goto bail_qp;
+		}
 		qp->priv = priv;
 		qp->timeout_jiffies =
 			usecs_to_jiffies((4096UL * (1UL << qp->timeout)) /
include/rdma/rdma_vt.h +3 -1
index 16274e2..9c9a27d 100644
@@ -203,7 +203,9 @@ struct rvt_driver_provided {
 
 	/*
 	 * Allocate a private queue pair data structure for driver specific
-	 * information which is opaque to rdmavt.
+	 * information which is opaque to rdmavt.  Errors are returned via
+	 * ERR_PTR(err).  The driver is free to return NULL or a valid
+	 * pointer.
 	 */
 	void * (*qp_priv_alloc)(struct rvt_dev_info *rdi, struct rvt_qp *qp,
 				gfp_t gfp);

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Applied
#1 lore raw
Quoted 7 lines · Dennis Dalessandro

From: Mike Marciniszyn <[email protected]>

The current drivers return errors from this calldown wrapped in an ERR_PTR().

The rdmavt code incorrectly tests for NULL.

Quoted 7 lines

The code is fixed to use IS_ERR() and change ret according to the driver return value.

Thanks, applied.

Signature · 2 lines
Doug Ledford <[email protected]>
              GPG KeyID: 0E572FDD