From: Simon Horman <horms@verge.net.au>
To: e1000-devel@lists.sourceforge.net, netdev@vger.kernel.org
Cc: Arnd Bergmann <arndbergmann@googlemail.com>,
Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [rfc 3/4] igb: Common error path in igb_init_vfs()
Date: Thu, 05 Nov 2009 11:58:50 +1100 [thread overview]
Message-ID: <20091105010627.806283906@vergenet.net> (raw)
In-Reply-To: 20091105005847.941190065@vergenet.net
[-- Attachment #1: igb_init_vf-err.patch --]
[-- Type: text/plain, Size: 1927 bytes --]
Drop out into an error path on error.
This is a bit superfluous as things stand, though arguably
it already makes the code cleaner. But it should help things a lot
if igb_init_vfs() has a several things to unwind on error.
Signed-off-by: Simon Horman <horms@verge.net.au>
Index: net-next-2.6/drivers/net/igb/igb_main.c
===================================================================
--- net-next-2.6.orig/drivers/net/igb/igb_main.c 2009-11-05 04:52:16.000000000 +0900
+++ net-next-2.6/drivers/net/igb/igb_main.c 2009-11-05 16:36:01.000000000 +0900
@@ -1735,6 +1735,8 @@ static void __devinit igb_init_vf(struct
#ifdef CONFIG_PCI_IOV
struct pci_dev *pdev = adapter->pdev;
struct e1000_hw *hw = &adapter->hw;
+ unsigned char mac_addr[ETH_ALEN];
+ int i;
if (hw->mac.type != e1000_82576 || !vfn)
return;
@@ -1751,20 +1753,21 @@ static void __devinit igb_init_vf(struct
return;
}
- if (pci_enable_sriov(pdev, vfn)) {
- kfree(adapter->vf_data);
- adapter->vf_data = NULL;
- } else {
- unsigned char mac_addr[ETH_ALEN];
- int i;
- dev_info(&pdev->dev, "%d vfs allocated\n", vfn);
- for (i = 0; i < vfn; i++) {
- random_ether_addr(mac_addr);
- igb_set_vf_mac(adapter, i, mac_addr);
- }
+ if (pci_enable_sriov(pdev, vfn))
+ goto err;
+
+ dev_info(&pdev->dev, "%d vfs allocated\n", vfn);
+ for (i = 0; i < vfn; i++) {
+ random_ether_addr(mac_addr);
+ igb_set_vf_mac(adapter, i, mac_addr);
}
adapter->vfs_allocated_count = vfn;
+
+ return;
+err:
+ kfree(adapter->vf_data);
+ adapter->vf_data = NULL;
#endif /* CONFIG_PCI_IOV */
}
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
next prev parent reply other threads:[~2009-11-05 0:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-05 0:58 [rfc 0/4] igb: bandwidth allocation Simon Horman
2009-11-05 0:58 ` [rfc 1/4] igb: Add igb_cleanup_vf() Simon Horman
2009-11-05 0:58 ` [rfc 2/4] igb: Initialise adapter->vfs_allocated_count in igb_init_vf() Simon Horman
2009-11-05 0:58 ` Simon Horman [this message]
2009-11-05 0:58 ` [rfc 4/4] igb: expose 82576 bandiwidth allocation Simon Horman
2009-11-05 23:00 ` Alexander Duyck
2009-11-05 23:30 ` Simon Horman
2009-11-05 23:42 ` Alexander Duyck
2009-11-06 3:57 ` Simon Horman
2009-11-05 1:46 ` [rfc 0/4] igb: bandwidth allocation Jeff Kirsher
2009-11-05 2:21 ` Simon Horman
2009-11-14 8:01 ` Jeff Kirsher
2009-11-25 6:31 ` Simon Horman
2009-11-05 12:09 ` Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091105010627.806283906@vergenet.net \
--to=horms@verge.net.au \
--cc=arndbergmann@googlemail.com \
--cc=e1000-devel@lists.sourceforge.net \
--cc=jeffrey.t.kirsher@intel.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).