aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--net/bridge/br_if.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index bff0f5bb12b..c2397f503b0 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -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)