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 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 */ } -- 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