aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/igb/igb_main.c
diff options
context:
space:
mode:
authorNick Nunley <nicholasx.d.nunley@intel.com>2010-02-16 20:05:35 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-17 16:21:38 -0500
commitfe0592b4be0ce362e87cefd4f6dbf12cb5704d1b (patch)
tree80c9e3e34abd006657ea6bda991472fd9c781022 /drivers/net/igb/igb_main.c
parentd3eeb62ddd06ea20a054213cface92d328709285 (diff)
igb: use igb_free_q_vectors to cleanup failure in igb_alloc_q_vectors
This change makes it so that igb_free_q_vectors is reused in igb_alloc_q_vectors to handle the cleanup instead of unwinding through the allocations. Signed-off-by: Nicholas Nunley <nicholasx.d.nunley@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/igb/igb_main.c')
-rw-r--r--drivers/net/igb/igb_main.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index a9f4e0288409..ab7c5e97ed02 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -649,6 +649,8 @@ static void igb_free_q_vectors(struct igb_adapter *adapter)
649 for (v_idx = 0; v_idx < adapter->num_q_vectors; v_idx++) { 649 for (v_idx = 0; v_idx < adapter->num_q_vectors; v_idx++) {
650 struct igb_q_vector *q_vector = adapter->q_vector[v_idx]; 650 struct igb_q_vector *q_vector = adapter->q_vector[v_idx];
651 adapter->q_vector[v_idx] = NULL; 651 adapter->q_vector[v_idx] = NULL;
652 if (!q_vector)
653 continue;
652 netif_napi_del(&q_vector->napi); 654 netif_napi_del(&q_vector->napi);
653 kfree(q_vector); 655 kfree(q_vector);
654 } 656 }
@@ -768,13 +770,7 @@ static int igb_alloc_q_vectors(struct igb_adapter *adapter)
768 return 0; 770 return 0;
769 771
770err_out: 772err_out:
771 while (v_idx) { 773 igb_free_q_vectors(adapter);
772 v_idx--;
773 q_vector = adapter->q_vector[v_idx];
774 netif_napi_del(&q_vector->napi);
775 kfree(q_vector);
776 adapter->q_vector[v_idx] = NULL;
777 }
778 return -ENOMEM; 774 return -ENOMEM;
779} 775}
780 776