mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
drivers:net: dma_alloc_coherent: use __GFP_ZERO instead of memset(, 0)
Reduce the number of calls required to alloc a zeroed block of memory. Trivially reduces overall object size. Other changes around these removals o Neaten call argument alignment o Remove an unnecessary OOM message after dma_alloc_coherent failure o Remove unnecessary gfp_t stack variable Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
7f9421c264
commit
1f9061d27d
38 changed files with 104 additions and 168 deletions
|
@ -862,25 +862,25 @@ static int bcm_enet_open(struct net_device *dev)
|
|||
|
||||
/* allocate rx dma ring */
|
||||
size = priv->rx_ring_size * sizeof(struct bcm_enet_desc);
|
||||
p = dma_alloc_coherent(kdev, size, &priv->rx_desc_dma, GFP_KERNEL);
|
||||
p = dma_alloc_coherent(kdev, size, &priv->rx_desc_dma,
|
||||
GFP_KERNEL | __GFP_ZERO);
|
||||
if (!p) {
|
||||
ret = -ENOMEM;
|
||||
goto out_freeirq_tx;
|
||||
}
|
||||
|
||||
memset(p, 0, size);
|
||||
priv->rx_desc_alloc_size = size;
|
||||
priv->rx_desc_cpu = p;
|
||||
|
||||
/* allocate tx dma ring */
|
||||
size = priv->tx_ring_size * sizeof(struct bcm_enet_desc);
|
||||
p = dma_alloc_coherent(kdev, size, &priv->tx_desc_dma, GFP_KERNEL);
|
||||
p = dma_alloc_coherent(kdev, size, &priv->tx_desc_dma,
|
||||
GFP_KERNEL | __GFP_ZERO);
|
||||
if (!p) {
|
||||
ret = -ENOMEM;
|
||||
goto out_free_rx_ring;
|
||||
}
|
||||
|
||||
memset(p, 0, size);
|
||||
priv->tx_desc_alloc_size = size;
|
||||
priv->tx_desc_cpu = p;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue