aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/pcnet32.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index 5fcd4d94871d..f89b7a1e24d6 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -1432,7 +1432,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, char *name)
1432 lp->tx_ring_size, 1432 lp->tx_ring_size,
1433 &lp->tx_ring_dma_addr); 1433 &lp->tx_ring_dma_addr);
1434 if (lp->tx_ring == NULL) { 1434 if (lp->tx_ring == NULL) {
1435 if (pcnet32_debug & NETIF_MSG_DRV) 1435 if (netif_msg_drv(lp))
1436 printk("\n" KERN_ERR PFX 1436 printk("\n" KERN_ERR PFX
1437 "%s: Consistent memory allocation failed.\n", 1437 "%s: Consistent memory allocation failed.\n",
1438 name); 1438 name);
@@ -1444,52 +1444,48 @@ static int pcnet32_alloc_ring(struct net_device *dev, char *name)
1444 lp->rx_ring_size, 1444 lp->rx_ring_size,
1445 &lp->rx_ring_dma_addr); 1445 &lp->rx_ring_dma_addr);
1446 if (lp->rx_ring == NULL) { 1446 if (lp->rx_ring == NULL) {
1447 if (pcnet32_debug & NETIF_MSG_DRV) 1447 if (netif_msg_drv(lp))
1448 printk("\n" KERN_ERR PFX 1448 printk("\n" KERN_ERR PFX
1449 "%s: Consistent memory allocation failed.\n", 1449 "%s: Consistent memory allocation failed.\n",
1450 name); 1450 name);
1451 return -ENOMEM; 1451 return -ENOMEM;
1452 } 1452 }
1453 1453
1454 lp->tx_dma_addr = kmalloc(sizeof(dma_addr_t) * lp->tx_ring_size, 1454 lp->tx_dma_addr = kcalloc(lp->tx_ring_size, sizeof(dma_addr_t),
1455 GFP_ATOMIC); 1455 GFP_ATOMIC);
1456 if (!lp->tx_dma_addr) { 1456 if (!lp->tx_dma_addr) {
1457 if (pcnet32_debug & NETIF_MSG_DRV) 1457 if (netif_msg_drv(lp))
1458 printk("\n" KERN_ERR PFX 1458 printk("\n" KERN_ERR PFX
1459 "%s: Memory allocation failed.\n", name); 1459 "%s: Memory allocation failed.\n", name);
1460 return -ENOMEM; 1460 return -ENOMEM;
1461 } 1461 }
1462 memset(lp->tx_dma_addr, 0, sizeof(dma_addr_t) * lp->tx_ring_size);
1463 1462
1464 lp->rx_dma_addr = kmalloc(sizeof(dma_addr_t) * lp->rx_ring_size, 1463 lp->rx_dma_addr = kcalloc(lp->rx_ring_size, sizeof(dma_addr_t),
1465 GFP_ATOMIC); 1464 GFP_ATOMIC);
1466 if (!lp->rx_dma_addr) { 1465 if (!lp->rx_dma_addr) {
1467 if (pcnet32_debug & NETIF_MSG_DRV) 1466 if (netif_msg_drv(lp))
1468 printk("\n" KERN_ERR PFX 1467 printk("\n" KERN_ERR PFX
1469 "%s: Memory allocation failed.\n", name); 1468 "%s: Memory allocation failed.\n", name);
1470 return -ENOMEM; 1469 return -ENOMEM;
1471 } 1470 }
1472 memset(lp->rx_dma_addr, 0, sizeof(dma_addr_t) * lp->rx_ring_size);
1473 1471
1474 lp->tx_skbuff = kmalloc(sizeof(struct sk_buff *) * lp->tx_ring_size, 1472 lp->tx_skbuff = kcalloc(lp->tx_ring_size, sizeof(struct sk_buff *),
1475 GFP_ATOMIC); 1473 GFP_ATOMIC);
1476 if (!lp->tx_skbuff) { 1474 if (!lp->tx_skbuff) {
1477 if (pcnet32_debug & NETIF_MSG_DRV) 1475 if (netif_msg_drv(lp))
1478 printk("\n" KERN_ERR PFX 1476 printk("\n" KERN_ERR PFX
1479 "%s: Memory allocation failed.\n", name); 1477 "%s: Memory allocation failed.\n", name);
1480 return -ENOMEM; 1478 return -ENOMEM;
1481 } 1479 }
1482 memset(lp->tx_skbuff, 0, sizeof(struct sk_buff *) * lp->tx_ring_size);
1483 1480
1484 lp->rx_skbuff = kmalloc(sizeof(struct sk_buff *) * lp->rx_ring_size, 1481 lp->rx_skbuff = kcalloc(lp->rx_ring_size, sizeof(struct sk_buff *),
1485 GFP_ATOMIC); 1482 GFP_ATOMIC);
1486 if (!lp->rx_skbuff) { 1483 if (!lp->rx_skbuff) {
1487 if (pcnet32_debug & NETIF_MSG_DRV) 1484 if (netif_msg_drv(lp))
1488 printk("\n" KERN_ERR PFX 1485 printk("\n" KERN_ERR PFX
1489 "%s: Memory allocation failed.\n", name); 1486 "%s: Memory allocation failed.\n", name);
1490 return -ENOMEM; 1487 return -ENOMEM;
1491 } 1488 }
1492 memset(lp->rx_skbuff, 0, sizeof(struct sk_buff *) * lp->rx_ring_size);
1493 1489
1494 return 0; 1490 return 0;
1495} 1491}