From patchwork Fri May 1 21:44:23 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 26786 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 3D878B707D for ; Sat, 2 May 2009 07:44:45 +1000 (EST) Received: by ozlabs.org (Postfix) id 29BBEDDF19; Sat, 2 May 2009 07:44:45 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id A83FBDDF01 for ; Sat, 2 May 2009 07:44:44 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756281AbZEAVoa (ORCPT ); Fri, 1 May 2009 17:44:30 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753789AbZEAVoa (ORCPT ); Fri, 1 May 2009 17:44:30 -0400 Received: from mx2.redhat.com ([66.187.237.31]:45521 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753336AbZEAVo3 (ORCPT ); Fri, 1 May 2009 17:44:29 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n41LiQ0F020193; Fri, 1 May 2009 17:44:26 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n41LiOJE024948; Fri, 1 May 2009 17:44:25 -0400 Received: from localhost (vpn-10-62.str.redhat.com [10.32.10.62]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n41LiNsj024799; Fri, 1 May 2009 17:44:24 -0400 Date: Fri, 1 May 2009 23:44:23 +0200 From: Jiri Pirko To: netdev@vger.kernel.org Cc: fubar@us.ibm.com, bonding-devel@lists.sourceforge.net Subject: [PATCH] bonding: correct the cleanup in bond_create() Message-ID: <20090501214422.GA16065@psychotron.englab.brq.redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch makes the cleanup in bond_create nicer :) Also now the forgotten free_netdev is called. Jirka Signed-off-by: Jiri Pirko drivers/net/bonding/bond_main.c | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-) --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index fd73836..a35374a 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -5173,16 +5173,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: