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:
@@ -780,12 +780,11 @@ static int ftgmac100_alloc_buffers(struct ftgmac100 *priv)
|
||||
|
||||
priv->descs = dma_alloc_coherent(priv->dev,
|
||||
sizeof(struct ftgmac100_descs),
|
||||
&priv->descs_dma_addr, GFP_KERNEL);
|
||||
&priv->descs_dma_addr,
|
||||
GFP_KERNEL | __GFP_ZERO);
|
||||
if (!priv->descs)
|
||||
return -ENOMEM;
|
||||
|
||||
memset(priv->descs, 0, sizeof(struct ftgmac100_descs));
|
||||
|
||||
/* initialize RX ring */
|
||||
ftgmac100_rxdes_set_end_of_ring(&priv->descs->rxdes[RX_QUEUE_ENTRIES - 1]);
|
||||
|
||||
|
@@ -732,13 +732,13 @@ static int ftmac100_alloc_buffers(struct ftmac100 *priv)
|
||||
{
|
||||
int i;
|
||||
|
||||
priv->descs = dma_alloc_coherent(priv->dev, sizeof(struct ftmac100_descs),
|
||||
&priv->descs_dma_addr, GFP_KERNEL);
|
||||
priv->descs = dma_alloc_coherent(priv->dev,
|
||||
sizeof(struct ftmac100_descs),
|
||||
&priv->descs_dma_addr,
|
||||
GFP_KERNEL | __GFP_ZERO);
|
||||
if (!priv->descs)
|
||||
return -ENOMEM;
|
||||
|
||||
memset(priv->descs, 0, sizeof(struct ftmac100_descs));
|
||||
|
||||
/* initialize RX ring */
|
||||
ftmac100_rxdes_set_end_of_ring(&priv->descs->rxdes[RX_QUEUE_ENTRIES - 1]);
|
||||
|
||||
|
Reference in New Issue
Block a user