summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorNick Nunley <nicholasx.d.nunley@intel.com>2010-02-17 01:05:35 +0000
committerDavid S. Miller <davem@davemloft.net>2010-02-17 13:21:38 -0800
commitfe0592b4be0ce362e87cefd4f6dbf12cb5704d1b (patch)
tree80c9e3e34abd006657ea6bda991472fd9c781022 /drivers
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')
-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 a9f4e028840..ab7c5e97ed0 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)
for (v_idx = 0; v_idx < adapter->num_q_vectors; v_idx++) {
struct igb_q_vector *q_vector = adapter->q_vector[v_idx];
adapter->q_vector[v_idx] = NULL;
+ if (!q_vector)
+ continue;
netif_napi_del(&q_vector->napi);
kfree(q_vector);
}
@@ -768,13 +770,7 @@ static int igb_alloc_q_vectors(struct igb_adapter *adapter)
return 0;
err_out:
- while (v_idx) {
- v_idx--;
- q_vector = adapter->q_vector[v_idx];
- netif_napi_del(&q_vector->napi);
- kfree(q_vector);
- adapter->q_vector[v_idx] = NULL;
- }
+ igb_free_q_vectors(adapter);
return -ENOMEM;
}