net: stmmac: Make 'alloc_dma_[rt]x_desc_resources()' look even closer
authorChristophe Jaillet <christophe.jaillet@wanadoo.fr>
Sat, 8 Jul 2017 07:46:54 +0000 (09:46 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 11 Jul 2017 20:33:54 +0000 (13:33 -0700)
'alloc_dma_[rt]x_desc_resources()' functions look very close.
Remove a useless initialization and use the same label name for error
handling path in order to get them even closer.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index 07d486a70118d0b1ebc62747cf49f7680a5a60b1..1853f7ff6657562cc95e78bdf7954aa8203a7ccd 100644 (file)
@@ -1449,7 +1449,7 @@ static void free_dma_rx_desc_resources(struct stmmac_priv *priv)
 static void free_dma_tx_desc_resources(struct stmmac_priv *priv)
 {
        u32 tx_count = priv->plat->tx_queues_to_use;
-       u32 queue = 0;
+       u32 queue;
 
        /* Free TX queue resources */
        for (queue = 0; queue < tx_count; queue++) {
@@ -1561,13 +1561,13 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv)
                                                    sizeof(*tx_q->tx_skbuff_dma),
                                                    GFP_KERNEL);
                if (!tx_q->tx_skbuff_dma)
-                       goto err_dma_buffers;
+                       goto err_dma;
 
                tx_q->tx_skbuff = kmalloc_array(DMA_TX_SIZE,
                                                sizeof(struct sk_buff *),
                                                GFP_KERNEL);
                if (!tx_q->tx_skbuff)
-                       goto err_dma_buffers;
+                       goto err_dma;
 
                if (priv->extend_desc) {
                        tx_q->dma_etx = dma_zalloc_coherent(priv->device,
@@ -1577,7 +1577,7 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv)
                                                            &tx_q->dma_tx_phy,
                                                            GFP_KERNEL);
                        if (!tx_q->dma_etx)
-                               goto err_dma_buffers;
+                               goto err_dma;
                } else {
                        tx_q->dma_tx = dma_zalloc_coherent(priv->device,
                                                           DMA_TX_SIZE *
@@ -1586,13 +1586,13 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv)
                                                           &tx_q->dma_tx_phy,
                                                           GFP_KERNEL);
                        if (!tx_q->dma_tx)
-                               goto err_dma_buffers;
+                               goto err_dma;
                }
        }
 
        return 0;
 
-err_dma_buffers:
+err_dma:
        free_dma_tx_desc_resources(priv);
 
        return ret;