diff options
author | Roland Dreier <rolandd@cisco.com> | 2007-03-01 16:17:14 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2007-03-01 16:17:14 -0500 |
commit | 88171cfed5810a2354eb1977883589a05ce8d304 (patch) | |
tree | 3b6240f56d69f323c2e769a0b36340f73276a4f1 | |
parent | 31726798bd8fbef6244b28cf962f4a4c45793dea (diff) |
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 <rolandd@cisco.com>
-rw-r--r-- | 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 71dc84bd4254..1c6b63aca268 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, | |||
1088 | static int mthca_alloc_memfree(struct mthca_dev *dev, | 1088 | static int mthca_alloc_memfree(struct mthca_dev *dev, |
1089 | struct mthca_qp *qp) | 1089 | struct mthca_qp *qp) |
1090 | { | 1090 | { |
1091 | int ret = 0; | ||
1092 | |||
1093 | if (mthca_is_memfree(dev)) { | 1091 | if (mthca_is_memfree(dev)) { |
1094 | qp->rq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_RQ, | 1092 | qp->rq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_RQ, |
1095 | qp->qpn, &qp->rq.db); | 1093 | qp->qpn, &qp->rq.db); |
1096 | if (qp->rq.db_index < 0) | 1094 | if (qp->rq.db_index < 0) |
1097 | return ret; | 1095 | return -ENOMEM; |
1098 | 1096 | ||
1099 | qp->sq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_SQ, | 1097 | qp->sq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_SQ, |
1100 | qp->qpn, &qp->sq.db); | 1098 | qp->qpn, &qp->sq.db); |
1101 | if (qp->sq.db_index < 0) | 1099 | if (qp->sq.db_index < 0) { |
1102 | mthca_free_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index); | 1100 | mthca_free_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index); |
1101 | return -ENOMEM; | ||
1102 | } | ||
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | return ret; | 1105 | return 0; |
1106 | } | 1106 | } |
1107 | 1107 | ||
1108 | static void mthca_free_memfree(struct mthca_dev *dev, | 1108 | static void mthca_free_memfree(struct mthca_dev *dev, |