From: Pavel Emelyanov Date: Mon, 5 May 2008 00:58:07 +0000 (-0700) Subject: bridge: Consolidate error paths in br_add_bridge(). X-Git-Tag: v2.6.26-rc2~60^2~12 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=e340a90e6e07bba6e6b3fc39dd5fa76f95579d7c;p=linux-2.6-omap-h63xx.git 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 Signed-off-by: David S. Miller --- 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)