[IPoIB] Rename ipoib_create_qp() -> ipoib_init_qp() and fix error cleanup

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>
This commit is contained in:
Roland Dreier 2005-10-11 11:08:24 -07:00
parent efaae8f71f
commit 5b6810e048
3 changed files with 8 additions and 7 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
@ -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)