diff options
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 8c9518e946fa..7bfea5e9030e 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -3337,7 +3337,7 @@ int register_netdevice(struct net_device *dev) | |||
3337 | 3337 | ||
3338 | if (!dev_valid_name(dev->name)) { | 3338 | if (!dev_valid_name(dev->name)) { |
3339 | ret = -EINVAL; | 3339 | ret = -EINVAL; |
3340 | goto out; | 3340 | goto err_uninit; |
3341 | } | 3341 | } |
3342 | 3342 | ||
3343 | dev->ifindex = dev_new_index(); | 3343 | dev->ifindex = dev_new_index(); |
@@ -3351,7 +3351,7 @@ int register_netdevice(struct net_device *dev) | |||
3351 | = hlist_entry(p, struct net_device, name_hlist); | 3351 | = hlist_entry(p, struct net_device, name_hlist); |
3352 | if (!strncmp(d->name, dev->name, IFNAMSIZ)) { | 3352 | if (!strncmp(d->name, dev->name, IFNAMSIZ)) { |
3353 | ret = -EEXIST; | 3353 | ret = -EEXIST; |
3354 | goto out; | 3354 | goto err_uninit; |
3355 | } | 3355 | } |
3356 | } | 3356 | } |
3357 | 3357 | ||
@@ -3411,7 +3411,7 @@ int register_netdevice(struct net_device *dev) | |||
3411 | 3411 | ||
3412 | ret = netdev_register_sysfs(dev); | 3412 | ret = netdev_register_sysfs(dev); |
3413 | if (ret) | 3413 | if (ret) |
3414 | goto out; | 3414 | goto err_uninit; |
3415 | dev->reg_state = NETREG_REGISTERED; | 3415 | dev->reg_state = NETREG_REGISTERED; |
3416 | 3416 | ||
3417 | /* | 3417 | /* |
@@ -3436,6 +3436,11 @@ int register_netdevice(struct net_device *dev) | |||
3436 | 3436 | ||
3437 | out: | 3437 | out: |
3438 | return ret; | 3438 | return ret; |
3439 | |||
3440 | err_uninit: | ||
3441 | if (dev->uninit) | ||
3442 | dev->uninit(dev); | ||
3443 | goto out; | ||
3439 | } | 3444 | } |
3440 | 3445 | ||
3441 | /** | 3446 | /** |