whenever add_one failed to load one of the port, call remove one
after that, otherwise it ends with panic, (many resources are
for all the ports and some actions will be aken over both of them
without considering that one of them failed to load)
Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
(Ported from Mellanox OFED 2.4)
Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
struct net_device *dev;
struct ipoib_dev_priv *priv;
int s, e, p;
+ int is_error_init = 0;
if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB)
return;
if (!IS_ERR(dev)) {
priv = netdev_priv(dev);
list_add_tail(&priv->list, dev_list);
- }
+ } else
+ is_error_init = 1;
}
-
ib_set_client_data(device, &ipoib_client, dev_list);
+
+ if (is_error_init) {
+ printk(KERN_ERR "%s: Failed to init ib port, removing it\n",
+ __func__);
+ ipoib_remove_one(device);
+ }
}
static void ipoib_remove_one(struct ib_device *device)