amd-xgbe: Free channel/ring structures later
authorLendacky, Thomas <Thomas.Lendacky@amd.com>
Thu, 6 Nov 2014 23:02:13 +0000 (17:02 -0600)
committerDavid S. Miller <davem@davemloft.net>
Fri, 7 Nov 2014 00:00:15 +0000 (19:00 -0500)
The channel structure is freed before freeing the per channel
interrupts resulting in a kernel oops. Move the call to free
the channel structure to after the freeing of the per channel
interrupts.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/amd/xgbe/xgbe-drv.c

index ced9f52eb45bdd7787822d3011a1eb66bfc5aef9..ec5fff38108d772ec8fa1e1da9cf4bd18520da99 100644 (file)
@@ -1369,9 +1369,6 @@ static int xgbe_close(struct net_device *netdev)
        /* Free the ring descriptors and buffers */
        desc_if->free_ring_resources(pdata);
 
-       /* Free the channel and ring structures */
-       xgbe_free_channels(pdata);
-
        /* Release the interrupts */
        devm_free_irq(pdata->dev, pdata->dev_irq, pdata);
        if (pdata->per_channel_irq) {
@@ -1380,6 +1377,9 @@ static int xgbe_close(struct net_device *netdev)
                        devm_free_irq(pdata->dev, channel->dma_irq, channel);
        }
 
+       /* Free the channel and ring structures */
+       xgbe_free_channels(pdata);
+
        /* Disable the clocks */
        clk_disable_unprepare(pdata->ptpclk);
        clk_disable_unprepare(pdata->sysclk);