bridge: Consolidate error paths in br_add_bridge().
authorPavel Emelyanov <xemul@openvz.org>
Mon, 5 May 2008 00:58:07 +0000 (17:58 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 5 May 2008 00:58:07 +0000 (17:58 -0700)
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>
net/bridge/br_if.c

index bff0f5bb12be4598070465b68a5e30fba18c6c6e..c2397f503b0f94e850d7da40b68e53fb16b9f9ae 100644 (file)
@@ -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)