Merge tag 'qcom-arm64-defconfig-fixes-for-4.13-rc2' of git://git.kernel.org/pub/scm...
[sfrench/cifs-2.6.git] / drivers / net / ethernet / stmicro / stmmac / stmmac_main.c
index 19bba6281dab703fa3bd96467e645da890abdb0e..1763e48c84e2090678f4ffc1b55cf1d7a62382e4 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++) {
@@ -1498,7 +1498,7 @@ static int alloc_dma_rx_desc_resources(struct stmmac_priv *priv)
                                                    sizeof(dma_addr_t),
                                                    GFP_KERNEL);
                if (!rx_q->rx_skbuff_dma)
-                       return -ENOMEM;
+                       goto err_dma;
 
                rx_q->rx_skbuff = kmalloc_array(DMA_RX_SIZE,
                                                sizeof(struct sk_buff *),
@@ -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)
-                       return -ENOMEM;
+                       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;
@@ -4120,8 +4120,15 @@ int stmmac_dvr_probe(struct device *device,
        if ((phyaddr >= 0) && (phyaddr <= 31))
                priv->plat->phy_addr = phyaddr;
 
-       if (priv->plat->stmmac_rst)
+       if (priv->plat->stmmac_rst) {
+               ret = reset_control_assert(priv->plat->stmmac_rst);
                reset_control_deassert(priv->plat->stmmac_rst);
+               /* Some reset controllers have only reset callback instead of
+                * assert + deassert callbacks pair.
+                */
+               if (ret == -ENOTSUPP)
+                       reset_control_reset(priv->plat->stmmac_rst);
+       }
 
        /* Init MAC and get the capabilities */
        ret = stmmac_hw_init(priv);