diff options
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 22bd03bd1d35..9a5feaf4bab9 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -4917,8 +4917,9 @@ int bond_create(struct net *net, const char *name) | |||
4917 | 4917 | ||
4918 | rtnl_lock(); | 4918 | rtnl_lock(); |
4919 | 4919 | ||
4920 | bond_dev = alloc_netdev_mq(sizeof(struct bonding), name ? name : "", | 4920 | bond_dev = alloc_netdev_mq(sizeof(struct bonding), |
4921 | bond_setup, tx_queues); | 4921 | name ? name : "bond%d", |
4922 | bond_setup, tx_queues); | ||
4922 | if (!bond_dev) { | 4923 | if (!bond_dev) { |
4923 | pr_err("%s: eek! can't alloc netdev!\n", name); | 4924 | pr_err("%s: eek! can't alloc netdev!\n", name); |
4924 | rtnl_unlock(); | 4925 | rtnl_unlock(); |
@@ -4928,26 +4929,10 @@ int bond_create(struct net *net, const char *name) | |||
4928 | dev_net_set(bond_dev, net); | 4929 | dev_net_set(bond_dev, net); |
4929 | bond_dev->rtnl_link_ops = &bond_link_ops; | 4930 | bond_dev->rtnl_link_ops = &bond_link_ops; |
4930 | 4931 | ||
4931 | if (!name) { | ||
4932 | res = dev_alloc_name(bond_dev, "bond%d"); | ||
4933 | if (res < 0) | ||
4934 | goto out; | ||
4935 | } else { | ||
4936 | /* | ||
4937 | * If we're given a name to register | ||
4938 | * we need to ensure that its not already | ||
4939 | * registered | ||
4940 | */ | ||
4941 | res = -EEXIST; | ||
4942 | if (__dev_get_by_name(net, name) != NULL) | ||
4943 | goto out; | ||
4944 | } | ||
4945 | |||
4946 | res = register_netdevice(bond_dev); | 4932 | res = register_netdevice(bond_dev); |
4947 | 4933 | ||
4948 | netif_carrier_off(bond_dev); | 4934 | netif_carrier_off(bond_dev); |
4949 | 4935 | ||
4950 | out: | ||
4951 | rtnl_unlock(); | 4936 | rtnl_unlock(); |
4952 | if (res < 0) | 4937 | if (res < 0) |
4953 | bond_destructor(bond_dev); | 4938 | bond_destructor(bond_dev); |