[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>
This commit is contained in:
parent
2478173464
commit
1b30dd359e
@ -486,10 +486,9 @@ ax25_cb *ax25_create_cb(void)
|
|||||||
{
|
{
|
||||||
ax25_cb *ax25;
|
ax25_cb *ax25;
|
||||||
|
|
||||||
if ((ax25 = kmalloc(sizeof(*ax25), GFP_ATOMIC)) == NULL)
|
if ((ax25 = kzalloc(sizeof(*ax25), GFP_ATOMIC)) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
memset(ax25, 0x00, sizeof(*ax25));
|
|
||||||
atomic_set(&ax25->refcount, 1);
|
atomic_set(&ax25->refcount, 1);
|
||||||
|
|
||||||
skb_queue_head_init(&ax25->write_queue);
|
skb_queue_head_init(&ax25->write_queue);
|
||||||
|
@ -55,15 +55,13 @@ void ax25_dev_device_up(struct net_device *dev)
|
|||||||
{
|
{
|
||||||
ax25_dev *ax25_dev;
|
ax25_dev *ax25_dev;
|
||||||
|
|
||||||
if ((ax25_dev = kmalloc(sizeof(*ax25_dev), GFP_ATOMIC)) == NULL) {
|
if ((ax25_dev = kzalloc(sizeof(*ax25_dev), GFP_ATOMIC)) == NULL) {
|
||||||
printk(KERN_ERR "AX.25: ax25_dev_device_up - out of memory\n");
|
printk(KERN_ERR "AX.25: ax25_dev_device_up - out of memory\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ax25_unregister_sysctl();
|
ax25_unregister_sysctl();
|
||||||
|
|
||||||
memset(ax25_dev, 0x00, sizeof(*ax25_dev));
|
|
||||||
|
|
||||||
dev->ax25_ptr = ax25_dev;
|
dev->ax25_ptr = ax25_dev;
|
||||||
ax25_dev->dev = dev;
|
ax25_dev->dev = dev;
|
||||||
dev_hold(dev);
|
dev_hold(dev);
|
||||||
|
@ -1382,14 +1382,12 @@ static int __init nr_proto_init(void)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_nr = kmalloc(nr_ndevs * sizeof(struct net_device *), GFP_KERNEL);
|
dev_nr = kzalloc(nr_ndevs * sizeof(struct net_device *), GFP_KERNEL);
|
||||||
if (dev_nr == NULL) {
|
if (dev_nr == NULL) {
|
||||||
printk(KERN_ERR "NET/ROM: nr_proto_init - unable to allocate device array\n");
|
printk(KERN_ERR "NET/ROM: nr_proto_init - unable to allocate device array\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(dev_nr, 0x00, nr_ndevs * sizeof(struct net_device *));
|
|
||||||
|
|
||||||
for (i = 0; i < nr_ndevs; i++) {
|
for (i = 0; i < nr_ndevs; i++) {
|
||||||
char name[IFNAMSIZ];
|
char name[IFNAMSIZ];
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
|
@ -1490,14 +1490,13 @@ static int __init rose_proto_init(void)
|
|||||||
|
|
||||||
rose_callsign = null_ax25_address;
|
rose_callsign = null_ax25_address;
|
||||||
|
|
||||||
dev_rose = kmalloc(rose_ndevs * sizeof(struct net_device *), GFP_KERNEL);
|
dev_rose = kzalloc(rose_ndevs * sizeof(struct net_device *), GFP_KERNEL);
|
||||||
if (dev_rose == NULL) {
|
if (dev_rose == NULL) {
|
||||||
printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate device structure\n");
|
printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate device structure\n");
|
||||||
rc = -ENOMEM;
|
rc = -ENOMEM;
|
||||||
goto out_proto_unregister;
|
goto out_proto_unregister;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(dev_rose, 0x00, rose_ndevs * sizeof(struct net_device*));
|
|
||||||
for (i = 0; i < rose_ndevs; i++) {
|
for (i = 0; i < rose_ndevs; i++) {
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
char name[IFNAMSIZ];
|
char name[IFNAMSIZ];
|
||||||
|
Loading…
Reference in New Issue
Block a user