diff options
author | Ajit Khaparde <ajit.khaparde@emulex.com> | 2011-04-06 18:08:30 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-07 15:04:45 -0700 |
commit | 48f5a19168c228e6533401c563d9fcbc152bc33f (patch) | |
tree | 5d9968910d64671a5719f198528419c5daf94299 /drivers/net/benet/be_main.c | |
parent | 81be8f0ab47db1171dac0eb8b062291603b57dd4 (diff) |
be2net: dynamically allocate adapter->vf_cfg
Instead of a fixed sized array for vf_cfg, allocate the size dynamically
depending on number of VFs the device supports.
Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet/be_main.c')
-rw-r--r-- | drivers/net/benet/be_main.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index bc110782da88..6e7df0dd418b 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c @@ -2838,6 +2838,7 @@ static void __devexit be_remove(struct pci_dev *pdev) be_ctrl_cleanup(adapter); + kfree(adapter->vf_cfg); be_sriov_disable(adapter); be_msix_disable(adapter); @@ -3022,16 +3023,23 @@ static int __devinit be_probe(struct pci_dev *pdev, } be_sriov_enable(adapter); + if (adapter->sriov_enabled) { + adapter->vf_cfg = kcalloc(num_vfs, + sizeof(struct be_vf_cfg), GFP_KERNEL); + + if (!adapter->vf_cfg) + goto free_netdev; + } status = be_ctrl_init(adapter); if (status) - goto free_netdev; + goto free_vf_cfg; if (lancer_chip(adapter)) { status = lancer_test_and_set_rdy_state(adapter); if (status) { dev_err(&pdev->dev, "Adapter in non recoverable error\n"); - goto free_netdev; + goto ctrl_clean; } } @@ -3093,6 +3101,8 @@ stats_clean: be_stats_cleanup(adapter); ctrl_clean: be_ctrl_cleanup(adapter); +free_vf_cfg: + kfree(adapter->vf_cfg); free_netdev: be_sriov_disable(adapter); free_netdev(netdev); |