bridge: Consolidate error paths in br_add_bridge().
This actually had to be merged with the patch #1, but I decided not to mix two changes in one patch. There are already two calls to free_netdev() in there, so merge them into one. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
c37aa90b04
commit
e340a90e6e
1 changed files with 8 additions and 8 deletions
|
@ -273,17 +273,13 @@ int br_add_bridge(const char *name)
|
||||||
rtnl_lock();
|
rtnl_lock();
|
||||||
if (strchr(dev->name, '%')) {
|
if (strchr(dev->name, '%')) {
|
||||||
ret = dev_alloc_name(dev, dev->name);
|
ret = dev_alloc_name(dev, dev->name);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
free_netdev(dev);
|
goto out_free;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = register_netdevice(dev);
|
ret = register_netdevice(dev);
|
||||||
if (ret) {
|
if (ret)
|
||||||
free_netdev(dev);
|
goto out_free;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = br_sysfs_addbr(dev);
|
ret = br_sysfs_addbr(dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -291,6 +287,10 @@ int br_add_bridge(const char *name)
|
||||||
out:
|
out:
|
||||||
rtnl_unlock();
|
rtnl_unlock();
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
out_free:
|
||||||
|
free_netdev(dev);
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
int br_del_bridge(const char *name)
|
int br_del_bridge(const char *name)
|
||||||
|
|
Loading…
Reference in a new issue