Skip to content

Commit

Permalink
[IPoIB] Rename ipoib_create_qp() -> ipoib_init_qp() and fix error cle…
Browse files Browse the repository at this point in the history
…anup

ipoib_create_qp() no longer creates IPoIB's QP, so it shouldn't
destroy the QP on failure -- that unwinding happens elsewhere, so the
current code can cause a double free.  While we're at it, the
function's name should match what it actually does, so rename it to
ipoib_init_qp().

Signed-off-by: Roland Dreier <rolandd@cisco.com>
  • Loading branch information
Roland Dreier committed Oct 17, 2005
1 parent efaae8f commit 5b6810e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion drivers/infiniband/ulp/ipoib/ipoib.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ int ipoib_mcast_attach(struct net_device *dev, u16 mlid,
int ipoib_mcast_detach(struct net_device *dev, u16 mlid,
union ib_gid *mgid);

int ipoib_qp_create(struct net_device *dev);
int ipoib_init_qp(struct net_device *dev);
int ipoib_transport_dev_init(struct net_device *dev, struct ib_device *ca);
void ipoib_transport_dev_cleanup(struct net_device *dev);

Expand Down
4 changes: 2 additions & 2 deletions drivers/infiniband/ulp/ipoib/ipoib_ib.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,9 @@ int ipoib_ib_dev_open(struct net_device *dev)
struct ipoib_dev_priv *priv = netdev_priv(dev);
int ret;

ret = ipoib_qp_create(dev);
ret = ipoib_init_qp(dev);
if (ret) {
ipoib_warn(priv, "ipoib_qp_create returned %d\n", ret);
ipoib_warn(priv, "ipoib_init_qp returned %d\n", ret);
return -1;
}

Expand Down
9 changes: 5 additions & 4 deletions drivers/infiniband/ulp/ipoib/ipoib_verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ int ipoib_mcast_detach(struct net_device *dev, u16 mlid, union ib_gid *mgid)
return ret;
}

int ipoib_qp_create(struct net_device *dev)
int ipoib_init_qp(struct net_device *dev)
{
struct ipoib_dev_priv *priv = netdev_priv(dev);
int ret;
Expand Down Expand Up @@ -149,10 +149,11 @@ int ipoib_qp_create(struct net_device *dev)
return 0;

out_fail:
ib_destroy_qp(priv->qp);
priv->qp = NULL;
qp_attr.qp_state = IB_QPS_RESET;
if (ib_modify_qp(priv->qp, &qp_attr, IB_QP_STATE))
ipoib_warn(priv, "Failed to modify QP to RESET state\n");

return -EINVAL;
return ret;
}

int ipoib_transport_dev_init(struct net_device *dev, struct ib_device *ca)
Expand Down

0 comments on commit 5b6810e

Please sign in to comment.