diff options
author | Joe Perches <joe@perches.com> | 2013-02-07 06:46:27 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-02-08 17:44:39 -0500 |
commit | 14f8dc49532f765968ff37c3b99edbeb99004ace (patch) | |
tree | a0c2f42ca545b3587a071ad05427c7351c8244e0 /drivers/net/ethernet/freescale | |
parent | e9ba103931950da7bc87d58ffe39612df17d47af (diff) |
drivers: net: Remove remaining alloc/OOM messages
alloc failures already get standardized OOM
messages and a dump_stack.
For the affected mallocs around these OOM messages:
Converted kmallocs with multiplies to kmalloc_array.
Converted a kmalloc/memcpy to kmemdup.
Removed now unused stack variables.
Removed unnecessary parentheses.
Neatened alignment.
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Arend van Spriel <arend@broadcom.com>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/freescale')
-rw-r--r-- | drivers/net/ethernet/freescale/gianfar.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index 75734bfed10f..ab32bd0be8ff 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c | |||
@@ -277,14 +277,12 @@ static int gfar_alloc_skb_resources(struct net_device *ndev) | |||
277 | /* Setup the skbuff rings */ | 277 | /* Setup the skbuff rings */ |
278 | for (i = 0; i < priv->num_tx_queues; i++) { | 278 | for (i = 0; i < priv->num_tx_queues; i++) { |
279 | tx_queue = priv->tx_queue[i]; | 279 | tx_queue = priv->tx_queue[i]; |
280 | tx_queue->tx_skbuff = kmalloc(sizeof(*tx_queue->tx_skbuff) * | 280 | tx_queue->tx_skbuff = |
281 | tx_queue->tx_ring_size, | 281 | kmalloc_array(tx_queue->tx_ring_size, |
282 | GFP_KERNEL); | 282 | sizeof(*tx_queue->tx_skbuff), |
283 | if (!tx_queue->tx_skbuff) { | 283 | GFP_KERNEL); |
284 | netif_err(priv, ifup, ndev, | 284 | if (!tx_queue->tx_skbuff) |
285 | "Could not allocate tx_skbuff\n"); | ||
286 | goto cleanup; | 285 | goto cleanup; |
287 | } | ||
288 | 286 | ||
289 | for (k = 0; k < tx_queue->tx_ring_size; k++) | 287 | for (k = 0; k < tx_queue->tx_ring_size; k++) |
290 | tx_queue->tx_skbuff[k] = NULL; | 288 | tx_queue->tx_skbuff[k] = NULL; |
@@ -292,15 +290,12 @@ static int gfar_alloc_skb_resources(struct net_device *ndev) | |||
292 | 290 | ||
293 | for (i = 0; i < priv->num_rx_queues; i++) { | 291 | for (i = 0; i < priv->num_rx_queues; i++) { |
294 | rx_queue = priv->rx_queue[i]; | 292 | rx_queue = priv->rx_queue[i]; |
295 | rx_queue->rx_skbuff = kmalloc(sizeof(*rx_queue->rx_skbuff) * | 293 | rx_queue->rx_skbuff = |
296 | rx_queue->rx_ring_size, | 294 | kmalloc_array(rx_queue->rx_ring_size, |
297 | GFP_KERNEL); | 295 | sizeof(*rx_queue->rx_skbuff), |
298 | 296 | GFP_KERNEL); | |
299 | if (!rx_queue->rx_skbuff) { | 297 | if (!rx_queue->rx_skbuff) |
300 | netif_err(priv, ifup, ndev, | ||
301 | "Could not allocate rx_skbuff\n"); | ||
302 | goto cleanup; | 298 | goto cleanup; |
303 | } | ||
304 | 299 | ||
305 | for (j = 0; j < rx_queue->rx_ring_size; j++) | 300 | for (j = 0; j < rx_queue->rx_ring_size; j++) |
306 | rx_queue->rx_skbuff[j] = NULL; | 301 | rx_queue->rx_skbuff[j] = NULL; |