]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
bonding: correct the cleanup in bond_create()
authorJiri Pirko <jpirko@redhat.com>
Fri, 1 May 2009 22:35:28 +0000 (15:35 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 1 May 2009 22:35:28 +0000 (15:35 -0700)
This patch makes the cleanup in bond_create nicer :) Also now the forgotten
free_netdev is called.

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bonding/bond_main.c

index 67515b78ff91a706cbf75720345bc5f384cebc86..2188a96fc090a644594ca17406acd8d041566982 100644 (file)
@@ -5158,16 +5158,15 @@ int bond_create(char *name, struct bond_params *params)
        up_write(&bonding_rwsem);
        rtnl_unlock(); /* allows sysfs registration of net device */
        res = bond_create_sysfs_entry(netdev_priv(bond_dev));
-       if (res < 0) {
-               rtnl_lock();
-               down_write(&bonding_rwsem);
-               bond_deinit(bond_dev);
-               unregister_netdevice(bond_dev);
-               goto out_rtnl;
-       }
+       if (res < 0)
+               goto out_unreg;
 
        return 0;
 
+out_unreg:
+       rtnl_lock();
+       down_write(&bonding_rwsem);
+       unregister_netdevice(bond_dev);
 out_bond:
        bond_deinit(bond_dev);
 out_netdev: