diff options
author | Joe Perches <joe@perches.com> | 2013-03-15 03:23:58 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-03-17 12:50:24 -0400 |
commit | 1f9061d27d3d2028805549c4a306324a48209057 (patch) | |
tree | 7cfb1a92933f5a9bba6745b68b6a964d9e757ef9 /drivers/net/ethernet/aeroflex | |
parent | 7f9421c264f8a6e6137027a45ae576517f66fa56 (diff) |
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>
Diffstat (limited to 'drivers/net/ethernet/aeroflex')
-rw-r--r-- | drivers/net/ethernet/aeroflex/greth.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c index 3a9fbacc3729..269295403fc4 100644 --- a/drivers/net/ethernet/aeroflex/greth.c +++ b/drivers/net/ethernet/aeroflex/greth.c | |||
@@ -1466,25 +1466,21 @@ static int greth_of_probe(struct platform_device *ofdev) | |||
1466 | /* Allocate TX descriptor ring in coherent memory */ | 1466 | /* Allocate TX descriptor ring in coherent memory */ |
1467 | greth->tx_bd_base = dma_alloc_coherent(greth->dev, 1024, | 1467 | greth->tx_bd_base = dma_alloc_coherent(greth->dev, 1024, |
1468 | &greth->tx_bd_base_phys, | 1468 | &greth->tx_bd_base_phys, |
1469 | GFP_KERNEL); | 1469 | GFP_KERNEL | __GFP_ZERO); |
1470 | if (!greth->tx_bd_base) { | 1470 | if (!greth->tx_bd_base) { |
1471 | err = -ENOMEM; | 1471 | err = -ENOMEM; |
1472 | goto error3; | 1472 | goto error3; |
1473 | } | 1473 | } |
1474 | 1474 | ||
1475 | memset(greth->tx_bd_base, 0, 1024); | ||
1476 | |||
1477 | /* Allocate RX descriptor ring in coherent memory */ | 1475 | /* Allocate RX descriptor ring in coherent memory */ |
1478 | greth->rx_bd_base = dma_alloc_coherent(greth->dev, 1024, | 1476 | greth->rx_bd_base = dma_alloc_coherent(greth->dev, 1024, |
1479 | &greth->rx_bd_base_phys, | 1477 | &greth->rx_bd_base_phys, |
1480 | GFP_KERNEL); | 1478 | GFP_KERNEL | __GFP_ZERO); |
1481 | if (!greth->rx_bd_base) { | 1479 | if (!greth->rx_bd_base) { |
1482 | err = -ENOMEM; | 1480 | err = -ENOMEM; |
1483 | goto error4; | 1481 | goto error4; |
1484 | } | 1482 | } |
1485 | 1483 | ||
1486 | memset(greth->rx_bd_base, 0, 1024); | ||
1487 | |||
1488 | /* Get MAC address from: module param, OF property or ID prom */ | 1484 | /* Get MAC address from: module param, OF property or ID prom */ |
1489 | for (i = 0; i < 6; i++) { | 1485 | for (i = 0; i < 6; i++) { |
1490 | if (macaddr[i] != 0) | 1486 | if (macaddr[i] != 0) |