Commit b70d4a51 authored by Antoine Tenart's avatar Antoine Tenart Committed by David S. Miller

net: mvpp2: only free the TSO header buffers when it was allocated

This patch adds a check to only free the TSO header buffer when its
allocation previously succeeded.
Signed-off-by: default avatarAntoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 48d79b49
...@@ -5802,6 +5802,7 @@ static int mvpp2_txq_init(struct mvpp2_port *port, ...@@ -5802,6 +5802,7 @@ static int mvpp2_txq_init(struct mvpp2_port *port,
txq_pcpu->reserved_num = 0; txq_pcpu->reserved_num = 0;
txq_pcpu->txq_put_index = 0; txq_pcpu->txq_put_index = 0;
txq_pcpu->txq_get_index = 0; txq_pcpu->txq_get_index = 0;
txq_pcpu->tso_headers = NULL;
txq_pcpu->stop_threshold = txq->size - MVPP2_MAX_SKB_DESCS; txq_pcpu->stop_threshold = txq->size - MVPP2_MAX_SKB_DESCS;
txq_pcpu->wake_threshold = txq_pcpu->stop_threshold / 2; txq_pcpu->wake_threshold = txq_pcpu->stop_threshold / 2;
...@@ -5829,10 +5830,13 @@ static void mvpp2_txq_deinit(struct mvpp2_port *port, ...@@ -5829,10 +5830,13 @@ static void mvpp2_txq_deinit(struct mvpp2_port *port,
txq_pcpu = per_cpu_ptr(txq->pcpu, cpu); txq_pcpu = per_cpu_ptr(txq->pcpu, cpu);
kfree(txq_pcpu->buffs); kfree(txq_pcpu->buffs);
if (txq_pcpu->tso_headers)
dma_free_coherent(port->dev->dev.parent, dma_free_coherent(port->dev->dev.parent,
txq_pcpu->size * TSO_HEADER_SIZE, txq_pcpu->size * TSO_HEADER_SIZE,
txq_pcpu->tso_headers, txq_pcpu->tso_headers,
txq_pcpu->tso_headers_dma); txq_pcpu->tso_headers_dma);
txq_pcpu->tso_headers = NULL;
} }
if (txq->descs) if (txq->descs)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment