Commit ec5e5ce1 authored by Jose Abreu's avatar Jose Abreu Committed by David S. Miller
Browse files

net: stmmac: Use kcalloc() instead of kmalloc_array()



We need the memory to be zeroed upon allocation so use kcalloc()
instead.

Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cbcf0999
Loading
Loading
Loading
Loading
+8 −9
Original line number Diff line number Diff line
@@ -1555,8 +1555,7 @@ static int alloc_dma_rx_desc_resources(struct stmmac_priv *priv)
			goto err_dma;
		}

		rx_q->buf_pool = kmalloc_array(DMA_RX_SIZE,
					       sizeof(*rx_q->buf_pool),
		rx_q->buf_pool = kcalloc(DMA_RX_SIZE, sizeof(*rx_q->buf_pool),
					 GFP_KERNEL);
		if (!rx_q->buf_pool)
			goto err_dma;
@@ -1608,13 +1607,13 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv)
		tx_q->queue_index = queue;
		tx_q->priv_data = priv;

		tx_q->tx_skbuff_dma = kmalloc_array(DMA_TX_SIZE,
		tx_q->tx_skbuff_dma = kcalloc(DMA_TX_SIZE,
					      sizeof(*tx_q->tx_skbuff_dma),
					      GFP_KERNEL);
		if (!tx_q->tx_skbuff_dma)
			goto err_dma;

		tx_q->tx_skbuff = kmalloc_array(DMA_TX_SIZE,
		tx_q->tx_skbuff = kcalloc(DMA_TX_SIZE,
					  sizeof(struct sk_buff *),
					  GFP_KERNEL);
		if (!tx_q->tx_skbuff)