diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2006-07-09 15:14:22 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-07-09 15:14:22 -0400 |
commit | 1b30dd359ebec22d035e8b145751319f63772ca1 (patch) | |
tree | 1efbdc5573940817dac79672357e1c2fa1ed6a28 /net | |
parent | 24781734643ea2e9fd864f58000e47793e2dcb04 (diff) |
[AX.25]: Use kzalloc
Replace kzalloc instead of kmalloc + memset.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ax25/af_ax25.c | 3 | ||||
-rw-r--r-- | net/ax25/ax25_dev.c | 4 | ||||
-rw-r--r-- | net/netrom/af_netrom.c | 4 | ||||
-rw-r--r-- | net/rose/af_rose.c | 3 |
4 files changed, 4 insertions, 10 deletions
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 10a3c0aa8398..f12be2acf9bc 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c | |||
@@ -486,10 +486,9 @@ ax25_cb *ax25_create_cb(void) | |||
486 | { | 486 | { |
487 | ax25_cb *ax25; | 487 | ax25_cb *ax25; |
488 | 488 | ||
489 | if ((ax25 = kmalloc(sizeof(*ax25), GFP_ATOMIC)) == NULL) | 489 | if ((ax25 = kzalloc(sizeof(*ax25), GFP_ATOMIC)) == NULL) |
490 | return NULL; | 490 | return NULL; |
491 | 491 | ||
492 | memset(ax25, 0x00, sizeof(*ax25)); | ||
493 | atomic_set(&ax25->refcount, 1); | 492 | atomic_set(&ax25->refcount, 1); |
494 | 493 | ||
495 | skb_queue_head_init(&ax25->write_queue); | 494 | skb_queue_head_init(&ax25->write_queue); |
diff --git a/net/ax25/ax25_dev.c b/net/ax25/ax25_dev.c index 47e6e790bd67..b787678220ff 100644 --- a/net/ax25/ax25_dev.c +++ b/net/ax25/ax25_dev.c | |||
@@ -55,15 +55,13 @@ void ax25_dev_device_up(struct net_device *dev) | |||
55 | { | 55 | { |
56 | ax25_dev *ax25_dev; | 56 | ax25_dev *ax25_dev; |
57 | 57 | ||
58 | if ((ax25_dev = kmalloc(sizeof(*ax25_dev), GFP_ATOMIC)) == NULL) { | 58 | if ((ax25_dev = kzalloc(sizeof(*ax25_dev), GFP_ATOMIC)) == NULL) { |
59 | printk(KERN_ERR "AX.25: ax25_dev_device_up - out of memory\n"); | 59 | printk(KERN_ERR "AX.25: ax25_dev_device_up - out of memory\n"); |
60 | return; | 60 | return; |
61 | } | 61 | } |
62 | 62 | ||
63 | ax25_unregister_sysctl(); | 63 | ax25_unregister_sysctl(); |
64 | 64 | ||
65 | memset(ax25_dev, 0x00, sizeof(*ax25_dev)); | ||
66 | |||
67 | dev->ax25_ptr = ax25_dev; | 65 | dev->ax25_ptr = ax25_dev; |
68 | ax25_dev->dev = dev; | 66 | ax25_dev->dev = dev; |
69 | dev_hold(dev); | 67 | dev_hold(dev); |
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index 389a4119e1b4..ecc796878f38 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c | |||
@@ -1382,14 +1382,12 @@ static int __init nr_proto_init(void) | |||
1382 | return -1; | 1382 | return -1; |
1383 | } | 1383 | } |
1384 | 1384 | ||
1385 | dev_nr = kmalloc(nr_ndevs * sizeof(struct net_device *), GFP_KERNEL); | 1385 | dev_nr = kzalloc(nr_ndevs * sizeof(struct net_device *), GFP_KERNEL); |
1386 | if (dev_nr == NULL) { | 1386 | if (dev_nr == NULL) { |
1387 | printk(KERN_ERR "NET/ROM: nr_proto_init - unable to allocate device array\n"); | 1387 | printk(KERN_ERR "NET/ROM: nr_proto_init - unable to allocate device array\n"); |
1388 | return -1; | 1388 | return -1; |
1389 | } | 1389 | } |
1390 | 1390 | ||
1391 | memset(dev_nr, 0x00, nr_ndevs * sizeof(struct net_device *)); | ||
1392 | |||
1393 | for (i = 0; i < nr_ndevs; i++) { | 1391 | for (i = 0; i < nr_ndevs; i++) { |
1394 | char name[IFNAMSIZ]; | 1392 | char name[IFNAMSIZ]; |
1395 | struct net_device *dev; | 1393 | struct net_device *dev; |
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index d0a67bb31363..c115295ab431 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c | |||
@@ -1490,14 +1490,13 @@ static int __init rose_proto_init(void) | |||
1490 | 1490 | ||
1491 | rose_callsign = null_ax25_address; | 1491 | rose_callsign = null_ax25_address; |
1492 | 1492 | ||
1493 | dev_rose = kmalloc(rose_ndevs * sizeof(struct net_device *), GFP_KERNEL); | 1493 | dev_rose = kzalloc(rose_ndevs * sizeof(struct net_device *), GFP_KERNEL); |
1494 | if (dev_rose == NULL) { | 1494 | if (dev_rose == NULL) { |
1495 | printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate device structure\n"); | 1495 | printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate device structure\n"); |
1496 | rc = -ENOMEM; | 1496 | rc = -ENOMEM; |
1497 | goto out_proto_unregister; | 1497 | goto out_proto_unregister; |
1498 | } | 1498 | } |
1499 | 1499 | ||
1500 | memset(dev_rose, 0x00, rose_ndevs * sizeof(struct net_device*)); | ||
1501 | for (i = 0; i < rose_ndevs; i++) { | 1500 | for (i = 0; i < rose_ndevs; i++) { |
1502 | struct net_device *dev; | 1501 | struct net_device *dev; |
1503 | char name[IFNAMSIZ]; | 1502 | char name[IFNAMSIZ]; |