net: macb: Free RX ring for all queues
authorHarini Katakam <harini.katakam@xilinx.com>
Fri, 6 Jul 2018 06:48:57 +0000 (12:18 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 24 Aug 2018 11:07:01 +0000 (13:07 +0200)
[ Upstream commit e50b770ea5c9eff0013e8ae714d20182ed50d5e6 ]

rx ring is allocated for all queues in macb_alloc_consistent.
Free the same for all queues instead of just Q0.

Signed-off-by: Harini Katakam <harini.katakam@xilinx.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/cadence/macb_main.c

index 068f991395dca754eef25485517b3cab528fc76f..01032f37a308e494f44efc0acb0b5740e25ab745 100644 (file)
@@ -1818,13 +1818,7 @@ static void macb_free_consistent(struct macb *bp)
        struct macb_queue *queue;
        unsigned int q;
 
-       queue = &bp->queues[0];
        bp->macbgem_ops.mog_free_rx_buffers(bp);
-       if (queue->rx_ring) {
-               dma_free_coherent(&bp->pdev->dev, RX_RING_BYTES(bp),
-                               queue->rx_ring, queue->rx_ring_dma);
-               queue->rx_ring = NULL;
-       }
 
        for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
                kfree(queue->tx_skb);
@@ -1834,6 +1828,11 @@ static void macb_free_consistent(struct macb *bp)
                                          queue->tx_ring, queue->tx_ring_dma);
                        queue->tx_ring = NULL;
                }
+               if (queue->rx_ring) {
+                       dma_free_coherent(&bp->pdev->dev, RX_RING_BYTES(bp),
+                                         queue->rx_ring, queue->rx_ring_dma);
+                       queue->rx_ring = NULL;
+               }
        }
 }