Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=88171cfed5810a2354eb1977883589a05ce8d304
Commit:     88171cfed5810a2354eb1977883589a05ce8d304
Parent:     31726798bd8fbef6244b28cf962f4a4c45793dea
Author:     Roland Dreier <[EMAIL PROTECTED]>
AuthorDate: Thu Mar 1 13:17:14 2007 -0800
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Thu Mar 1 13:17:14 2007 -0800

    IB/mthca: Fix error path in mthca_alloc_memfree()
    
    The garbled logic in mthca_alloc_memfree() causes it to return 0, even
    if it fails to allocate all doorbell records.  Fix it to return -ENOMEM
    when it fails.
    
    Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/mthca/mthca_qp.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c 
b/drivers/infiniband/hw/mthca/mthca_qp.c
index 71dc84b..1c6b63a 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -1088,21 +1088,21 @@ static void mthca_unmap_memfree(struct mthca_dev *dev,
 static int mthca_alloc_memfree(struct mthca_dev *dev,
                               struct mthca_qp *qp)
 {
-       int ret = 0;
-
        if (mthca_is_memfree(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 ret;
+                       return -ENOMEM;
 
                qp->sq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_SQ,
                                                 qp->qpn, &qp->sq.db);
-               if (qp->sq.db_index < 0)
+               if (qp->sq.db_index < 0) {
                        mthca_free_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index);
+                       return -ENOMEM;
+               }
        }
 
-       return ret;
+       return 0;
 }
 
 static void mthca_free_memfree(struct mthca_dev *dev,
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to