Skip to content

Commit ec5e5ce

Browse files
joabreudavem330
authored andcommitted
net: stmmac: Use kcalloc() instead of kmalloc_array()
We need the memory to be zeroed upon allocation so use kcalloc() instead. Signed-off-by: Jose Abreu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent cbcf099 commit ec5e5ce

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,9 +1555,8 @@ static int alloc_dma_rx_desc_resources(struct stmmac_priv *priv)
15551555
goto err_dma;
15561556
}
15571557

1558-
rx_q->buf_pool = kmalloc_array(DMA_RX_SIZE,
1559-
sizeof(*rx_q->buf_pool),
1560-
GFP_KERNEL);
1558+
rx_q->buf_pool = kcalloc(DMA_RX_SIZE, sizeof(*rx_q->buf_pool),
1559+
GFP_KERNEL);
15611560
if (!rx_q->buf_pool)
15621561
goto err_dma;
15631562

@@ -1608,15 +1607,15 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv)
16081607
tx_q->queue_index = queue;
16091608
tx_q->priv_data = priv;
16101609

1611-
tx_q->tx_skbuff_dma = kmalloc_array(DMA_TX_SIZE,
1612-
sizeof(*tx_q->tx_skbuff_dma),
1613-
GFP_KERNEL);
1610+
tx_q->tx_skbuff_dma = kcalloc(DMA_TX_SIZE,
1611+
sizeof(*tx_q->tx_skbuff_dma),
1612+
GFP_KERNEL);
16141613
if (!tx_q->tx_skbuff_dma)
16151614
goto err_dma;
16161615

1617-
tx_q->tx_skbuff = kmalloc_array(DMA_TX_SIZE,
1618-
sizeof(struct sk_buff *),
1619-
GFP_KERNEL);
1616+
tx_q->tx_skbuff = kcalloc(DMA_TX_SIZE,
1617+
sizeof(struct sk_buff *),
1618+
GFP_KERNEL);
16201619
if (!tx_q->tx_skbuff)
16211620
goto err_dma;
16221621

0 commit comments

Comments
 (0)