[ofa-general] Question about mthca_alloc_memfree and mthca_alloc_db

Ira Weiny weiny2 at llnl.gov
Thu Oct 4 15:30:10 PDT 2007


Roland,

We hit a bug in the RHEL4 kernel which was fixed in your latest tree.  The bug
was in mthca_alloc_memfree.  When comparing your code to the current RH kernel,
we wondered why you would not return the error code from mthca_alloc_db rather
than -ENOMEM as demonstrated in the patch below?

Thoughts?
Ira


>From f8c47490fd039efcf74f6470b34e2351fb302455 Mon Sep 17 00:00:00 2001
From: Ira K. Weiny <weiny2 at llnl.gov>
Date: Thu, 4 Oct 2007 15:16:45 -0700
Subject: [PATCH] Return the error code mthca_alloc_db rather than mask its code with ENOMEM.


Signed-off-by: Ira K. Weiny <weiny2 at llnl.gov>
---
 drivers/infiniband/hw/mthca/mthca_qp.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c
index df01b20..c1f7e14 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -1144,13 +1144,13 @@ static int mthca_alloc_memfree(struct mthca_dev *dev,
 		qp->rq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_RQ,
 						 qp->qpn, &qp->rq.db);
 		if (qp->rq.db_index < 0)
-			return -ENOMEM;
+			return (qp->rq.db_index);
 
 		qp->sq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_SQ,
 						 qp->qpn, &qp->sq.db);
 		if (qp->sq.db_index < 0) {
 			mthca_free_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index);
-			return -ENOMEM;
+			return (qp->sq.db_index);
 		}
 	}
 
-- 
1.5.1




More information about the general mailing list