提交 fe0592b4 编写于 作者: N Nick Nunley 提交者: David S. Miller

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: NNicholas Nunley <nicholasx.d.nunley@intel.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 d3eeb62d
...@@ -649,6 +649,8 @@ static void igb_free_q_vectors(struct igb_adapter *adapter) ...@@ -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++) { for (v_idx = 0; v_idx < adapter->num_q_vectors; v_idx++) {
struct igb_q_vector *q_vector = adapter->q_vector[v_idx]; struct igb_q_vector *q_vector = adapter->q_vector[v_idx];
adapter->q_vector[v_idx] = NULL; adapter->q_vector[v_idx] = NULL;
if (!q_vector)
continue;
netif_napi_del(&q_vector->napi); netif_napi_del(&q_vector->napi);
kfree(q_vector); kfree(q_vector);
} }
...@@ -768,13 +770,7 @@ static int igb_alloc_q_vectors(struct igb_adapter *adapter) ...@@ -768,13 +770,7 @@ static int igb_alloc_q_vectors(struct igb_adapter *adapter)
return 0; return 0;
err_out: err_out:
while (v_idx) { igb_free_q_vectors(adapter);
v_idx--;
q_vector = adapter->q_vector[v_idx];
netif_napi_del(&q_vector->napi);
kfree(q_vector);
adapter->q_vector[v_idx] = NULL;
}
return -ENOMEM; return -ENOMEM;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册