Commit e340a90e authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by David S. Miller

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: default avatarPavel Emelyanov <xemul@openvz.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c37aa90b
......@@ -273,17 +273,13 @@ int br_add_bridge(const char *name)
rtnl_lock();
if (strchr(dev->name, '%')) {
ret = dev_alloc_name(dev, dev->name);
if (ret < 0) {
free_netdev(dev);
goto out;
}
if (ret < 0)
goto out_free;
}
ret = register_netdevice(dev);
if (ret) {
free_netdev(dev);
goto out;
}
if (ret)
goto out_free;
ret = br_sysfs_addbr(dev);
if (ret)
......@@ -291,6 +287,10 @@ int br_add_bridge(const char *name)
out:
rtnl_unlock();
return ret;
out_free:
free_netdev(dev);
goto out;
}
int br_del_bridge(const char *name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment