[openib-general] [PATCH] mthca: fix uninitialized variable in mthca_alloc_qp
Jack Morgenstein
jackm at mellanox.co.il
Tue Mar 21 08:34:00 PST 2006
qp->transport was used uninitialized in mthca_alloc_qp() by
mthca_set_qp_size()
Signed-off-by: Jack Morgenstein <jackm at mellanox.co.il>
Index: drivers/infiniband/hw/mthca/mthca_qp.c
===================================================================
--- drivers/infiniband/hw/mthca/mthca_qp.c (revision 5935)
+++ drivers/infiniband/hw/mthca/mthca_qp.c (working copy)
@@ -1175,10 +1175,6 @@ int mthca_alloc_qp(struct mthca_dev *dev
{
int err;
- err = mthca_set_qp_size(dev, cap, pd, qp);
- if (err)
- return err;
-
switch (type) {
case IB_QPT_RC: qp->transport = RC; break;
case IB_QPT_UC: qp->transport = UC; break;
@@ -1186,6 +1182,10 @@ int mthca_alloc_qp(struct mthca_dev *dev
default: return -EINVAL;
}
+ err = mthca_set_qp_size(dev, cap, pd, qp);
+ if (err)
+ return err;
+
qp->qpn = mthca_alloc(&dev->qp_table.alloc);
if (qp->qpn == -1)
return -ENOMEM;
More information about the general
mailing list