[PATCH] pcnet32: Use kcalloc instead of kmalloc and memset

On 2006-03-08 Eric Sesterhenn wrote:
converts drivers/net to kzalloc usage.

Don Fry modified it to use netif_msg_drv. Tested ia32 and ppc64.

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: Don Fry <brazilnut@us.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>

authored by Don Fry and committed by Jeff Garzik 12fa30f3 6dcd60c2

+10 -14
+10 -14
drivers/net/pcnet32.c
··· 1432 1432 lp->tx_ring_size, 1433 1433 &lp->tx_ring_dma_addr); 1434 1434 if (lp->tx_ring == NULL) { 1435 - if (pcnet32_debug & NETIF_MSG_DRV) 1435 + if (netif_msg_drv(lp)) 1436 1436 printk("\n" KERN_ERR PFX 1437 1437 "%s: Consistent memory allocation failed.\n", 1438 1438 name); ··· 1444 1444 lp->rx_ring_size, 1445 1445 &lp->rx_ring_dma_addr); 1446 1446 if (lp->rx_ring == NULL) { 1447 - if (pcnet32_debug & NETIF_MSG_DRV) 1447 + if (netif_msg_drv(lp)) 1448 1448 printk("\n" KERN_ERR PFX 1449 1449 "%s: Consistent memory allocation failed.\n", 1450 1450 name); 1451 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 1455 GFP_ATOMIC); 1456 1456 if (!lp->tx_dma_addr) { 1457 - if (pcnet32_debug & NETIF_MSG_DRV) 1457 + if (netif_msg_drv(lp)) 1458 1458 printk("\n" KERN_ERR PFX 1459 1459 "%s: Memory allocation failed.\n", name); 1460 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 1464 GFP_ATOMIC); 1466 1465 if (!lp->rx_dma_addr) { 1467 - if (pcnet32_debug & NETIF_MSG_DRV) 1466 + if (netif_msg_drv(lp)) 1468 1467 printk("\n" KERN_ERR PFX 1469 1468 "%s: Memory allocation failed.\n", name); 1470 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 1473 GFP_ATOMIC); 1476 1474 if (!lp->tx_skbuff) { 1477 - if (pcnet32_debug & NETIF_MSG_DRV) 1475 + if (netif_msg_drv(lp)) 1478 1476 printk("\n" KERN_ERR PFX 1479 1477 "%s: Memory allocation failed.\n", name); 1480 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 1482 GFP_ATOMIC); 1486 1483 if (!lp->rx_skbuff) { 1487 - if (pcnet32_debug & NETIF_MSG_DRV) 1484 + if (netif_msg_drv(lp)) 1488 1485 printk("\n" KERN_ERR PFX 1489 1486 "%s: Memory allocation failed.\n", name); 1490 1487 return -ENOMEM; 1491 1488 } 1492 - memset(lp->rx_skbuff, 0, sizeof(struct sk_buff *) * lp->rx_ring_size); 1493 1489 1494 1490 return 0; 1495 1491 }