Skip to content

Commit

Permalink
IB/mthca: Fix uninitialized variable in mthca_alloc_qp()
Browse files Browse the repository at this point in the history
mthca_alloc_sqp() by mthca_set_qp_size() need to set qp->transport
before calling mthca_set_qp_size(), since the value is used there.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
  • Loading branch information
Jack Morgenstein authored and Roland Dreier committed Mar 24, 2006
1 parent d4301e2 commit b3f6496
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/infiniband/hw/mthca/mthca_qp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1196,17 +1196,17 @@ 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;
case IB_QPT_UD: qp->transport = UD; break;
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;
Expand Down Expand Up @@ -1239,6 +1239,7 @@ int mthca_alloc_sqp(struct mthca_dev *dev,
u32 mqpn = qpn * 2 + dev->qp_table.sqp_start + port - 1;
int err;

sqp->qp.transport = MLX;
err = mthca_set_qp_size(dev, cap, pd, &sqp->qp);
if (err)
return err;
Expand Down

0 comments on commit b3f6496

Please sign in to comment.