static void sh_eth_ring_free(struct net_device *ndev)
 {
        struct sh_eth_private *mdp = netdev_priv(ndev);
-       int i;
+       int ringsize, i;
 
        /* Free Rx skb ringbuffer */
        if (mdp->rx_skbuff) {
        }
        kfree(mdp->tx_skbuff);
        mdp->tx_skbuff = NULL;
+
+       if (mdp->rx_ring) {
+               ringsize = sizeof(struct sh_eth_rxdesc) * mdp->num_rx_ring;
+               dma_free_coherent(NULL, ringsize, mdp->rx_ring,
+                                 mdp->rx_desc_dma);
+               mdp->rx_ring = NULL;
+       }
+
+       if (mdp->tx_ring) {
+               ringsize = sizeof(struct sh_eth_txdesc) * mdp->num_tx_ring;
+               dma_free_coherent(NULL, ringsize, mdp->tx_ring,
+                                 mdp->tx_desc_dma);
+               mdp->tx_ring = NULL;
+       }
 }
 
 /* format skb and descriptor buffer */
        mdp->tx_skbuff = kcalloc(mdp->num_tx_ring, sizeof(*mdp->tx_skbuff),
                                 GFP_KERNEL);
        if (!mdp->tx_skbuff)
-               goto skb_ring_free;
+               goto ring_free;
 
        /* Allocate all Rx descriptors. */
        rx_ringsize = sizeof(struct sh_eth_rxdesc) * mdp->num_rx_ring;
        mdp->rx_ring = dma_alloc_coherent(NULL, rx_ringsize, &mdp->rx_desc_dma,
                                          GFP_KERNEL);
        if (!mdp->rx_ring)
-               goto skb_ring_free;
+               goto ring_free;
 
        mdp->dirty_rx = 0;
 
        mdp->tx_ring = dma_alloc_coherent(NULL, tx_ringsize, &mdp->tx_desc_dma,
                                          GFP_KERNEL);
        if (!mdp->tx_ring)
-               goto desc_ring_free;
+               goto ring_free;
        return 0;
 
-desc_ring_free:
-       /* free DMA buffer */
-       dma_free_coherent(NULL, rx_ringsize, mdp->rx_ring, mdp->rx_desc_dma);
-
-skb_ring_free:
-       /* Free Rx and Tx skb ring buffer */
+ring_free:
+       /* Free Rx and Tx skb ring buffer and DMA buffer */
        sh_eth_ring_free(ndev);
-       mdp->tx_ring = NULL;
-       mdp->rx_ring = NULL;
 
        return -ENOMEM;
 }
 
-static void sh_eth_free_dma_buffer(struct sh_eth_private *mdp)
-{
-       int ringsize;
-
-       if (mdp->rx_ring) {
-               ringsize = sizeof(struct sh_eth_rxdesc) * mdp->num_rx_ring;
-               dma_free_coherent(NULL, ringsize, mdp->rx_ring,
-                                 mdp->rx_desc_dma);
-               mdp->rx_ring = NULL;
-       }
-
-       if (mdp->tx_ring) {
-               ringsize = sizeof(struct sh_eth_txdesc) * mdp->num_tx_ring;
-               dma_free_coherent(NULL, ringsize, mdp->tx_ring,
-                                 mdp->tx_desc_dma);
-               mdp->tx_ring = NULL;
-       }
-}
-
 static int sh_eth_dev_init(struct net_device *ndev, bool start)
 {
        int ret = 0;
 
                sh_eth_dev_exit(ndev);
 
-               /* Free all the skbuffs in the Rx queue. */
+               /* Free all the skbuffs in the Rx queue and the DMA buffers. */
                sh_eth_ring_free(ndev);
-               /* Free DMA buffer */
-               sh_eth_free_dma_buffer(mdp);
        }
 
        /* Set new parameters */
 
        free_irq(ndev->irq, ndev);
 
-       /* Free all the skbuffs in the Rx queue. */
+       /* Free all the skbuffs in the Rx queue and the DMA buffer. */
        sh_eth_ring_free(ndev);
 
-       /* free DMA buffer */
-       sh_eth_free_dma_buffer(mdp);
-
        pm_runtime_put_sync(&mdp->pdev->dev);
 
        mdp->is_opened = 0;