]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ib/ipoib: getout whenever failed to load port.
authorErez Shitrit <erezsh@mellanox.com>
Mon, 28 Jan 2013 14:43:06 +0000 (16:43 +0200)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Tue, 7 Jul 2015 21:45:07 +0000 (14:45 -0700)
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>
drivers/infiniband/ulp/ipoib/ipoib_main.c

index 0e202d29606d0aea76757d954efc223359c74a0a..53c012ddffcc2668e4d847f8a2fb8842b76b3a3b 100644 (file)
@@ -1693,6 +1693,7 @@ static void ipoib_add_one(struct ib_device *device)
        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;
@@ -1718,10 +1719,16 @@ static void ipoib_add_one(struct ib_device *device)
                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)