ia64/xen-unstable

changeset 9305:56ec142bdd91

Substitute kmalloc+memset by kzalloc where possible

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
author vhanquez@kneesa.uk.xensource.com
date Fri Mar 17 09:52:05 2006 +0000 (2006-03-17)
parents 796ac2386a24
children 98a6f5ae7b1f
files linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Thu Mar 16 19:36:28 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Fri Mar 17 09:52:05 2006 +0000
     1.3 @@ -116,15 +116,13 @@ static int blkback_probe(struct xenbus_d
     1.4  			 const struct xenbus_device_id *id)
     1.5  {
     1.6  	int err;
     1.7 -	struct backend_info *be = kmalloc(sizeof(struct backend_info),
     1.8 +	struct backend_info *be = kzalloc(sizeof(struct backend_info),
     1.9  					  GFP_KERNEL);
    1.10  	if (!be) {
    1.11  		xenbus_dev_fatal(dev, -ENOMEM,
    1.12  				 "allocating backend structure");
    1.13  		return -ENOMEM;
    1.14  	}
    1.15 -	memset(be, 0, sizeof(*be));
    1.16 -
    1.17  	be->dev = dev;
    1.18  	dev->data = be;
    1.19  
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Thu Mar 16 19:36:28 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Fri Mar 17 09:52:05 2006 +0000
     2.3 @@ -90,13 +90,12 @@ static int blkfront_probe(struct xenbus_
     2.4  		return err;
     2.5  	}
     2.6  
     2.7 -	info = kmalloc(sizeof(*info), GFP_KERNEL);
     2.8 +	info = kzalloc(sizeof(*info), GFP_KERNEL);
     2.9  	if (!info) {
    2.10  		xenbus_dev_fatal(dev, -ENOMEM, "allocating info structure");
    2.11  		return -ENOMEM;
    2.12  	}
    2.13  
    2.14 -	memset(info, 0, sizeof(*info));
    2.15  	info->xbdev = dev;
    2.16  	info->vdevice = vdevice;
    2.17  	info->connected = BLKIF_STATE_DISCONNECTED;
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c	Thu Mar 16 19:36:28 2006 +0100
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c	Fri Mar 17 09:52:05 2006 +0000
     3.3 @@ -97,12 +97,10 @@ xlbd_alloc_major_info(int major, int min
     3.4  {
     3.5  	struct xlbd_major_info *ptr;
     3.6  
     3.7 -	ptr = kmalloc(sizeof(struct xlbd_major_info), GFP_KERNEL);
     3.8 +	ptr = kzalloc(sizeof(struct xlbd_major_info), GFP_KERNEL);
     3.9  	if (ptr == NULL)
    3.10  		return NULL;
    3.11  
    3.12 -	memset(ptr, 0, sizeof(struct xlbd_major_info));
    3.13 -
    3.14  	ptr->major = major;
    3.15  
    3.16  	switch (index) {
     4.1 --- a/linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c	Thu Mar 16 19:36:28 2006 +0100
     4.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c	Fri Mar 17 09:52:05 2006 +0000
     4.3 @@ -141,12 +141,11 @@ static int blkback_probe(struct xenbus_d
     4.4  	char *frontend;
     4.5  	int err;
     4.6  
     4.7 -	be = kmalloc(sizeof(*be), GFP_KERNEL);
     4.8 +	be = kzalloc(sizeof(*be), GFP_KERNEL);
     4.9  	if (!be) {
    4.10  		xenbus_dev_error(dev, -ENOMEM, "allocating backend structure");
    4.11  		return -ENOMEM;
    4.12  	}
    4.13 -	memset(be, 0, sizeof(*be));
    4.14  
    4.15  	frontend = NULL;
    4.16  	err = xenbus_gather(dev->nodename,
     5.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c	Thu Mar 16 19:36:28 2006 +0100
     5.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c	Fri Mar 17 09:52:05 2006 +0000
     5.3 @@ -76,14 +76,13 @@ static int netback_probe(struct xenbus_d
     5.4  			 const struct xenbus_device_id *id)
     5.5  {
     5.6  	int err;
     5.7 -	struct backend_info *be = kmalloc(sizeof(struct backend_info),
     5.8 +	struct backend_info *be = kzalloc(sizeof(struct backend_info),
     5.9  					  GFP_KERNEL);
    5.10  	if (!be) {
    5.11  		xenbus_dev_fatal(dev, -ENOMEM,
    5.12  				 "allocating backend structure");
    5.13  		return -ENOMEM;
    5.14  	}
    5.15 -	memset(be, 0, sizeof(*be));
    5.16  
    5.17  	be->dev = dev;
    5.18  	dev->data = be;
     6.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c	Thu Mar 16 19:36:28 2006 +0100
     6.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c	Fri Mar 17 09:52:05 2006 +0000
     6.3 @@ -67,7 +67,7 @@ static int tpmback_probe(struct xenbus_d
     6.4                           const struct xenbus_device_id *id)
     6.5  {
     6.6  	int err;
     6.7 -	struct backend_info *be = kmalloc(sizeof(struct backend_info),
     6.8 +	struct backend_info *be = kzalloc(sizeof(struct backend_info),
     6.9  	                                  GFP_KERNEL);
    6.10  
    6.11  	if (!be) {
    6.12 @@ -76,8 +76,6 @@ static int tpmback_probe(struct xenbus_d
    6.13  		return -ENOMEM;
    6.14  	}
    6.15  
    6.16 -	memset(be, 0, sizeof(*be));
    6.17 -
    6.18  	be->is_instance_set = 0;
    6.19  	be->dev = dev;
    6.20  	dev->data = be;
     7.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c	Thu Mar 16 19:36:28 2006 +0100
     7.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c	Fri Mar 17 09:52:05 2006 +0000
     7.3 @@ -179,11 +179,10 @@ static int xenbus_dev_open(struct inode 
     7.4  
     7.5  	nonseekable_open(inode, filp);
     7.6  
     7.7 -	u = kmalloc(sizeof(*u), GFP_KERNEL);
     7.8 +	u = kzalloc(sizeof(*u), GFP_KERNEL);
     7.9  	if (u == NULL)
    7.10  		return -ENOMEM;
    7.11  
    7.12 -	memset(u, 0, sizeof(*u));
    7.13  	INIT_LIST_HEAD(&u->transactions);
    7.14  	init_waitqueue_head(&u->read_waitq);
    7.15  
     8.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Thu Mar 16 19:36:28 2006 +0100
     8.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Fri Mar 17 09:52:05 2006 +0000
     8.3 @@ -552,10 +552,9 @@ static int xenbus_probe_node(struct xen_
     8.4  	}
     8.5  
     8.6  	stringlen = strlen(nodename) + 1 + strlen(type) + 1;
     8.7 -	xendev = kmalloc(sizeof(*xendev) + stringlen, GFP_KERNEL);
     8.8 +	xendev = kzalloc(sizeof(*xendev) + stringlen, GFP_KERNEL);
     8.9  	if (!xendev)
    8.10  		return -ENOMEM;
    8.11 -	memset(xendev, 0, sizeof(*xendev));
    8.12  
    8.13  	/* Copy the strings into the extra space. */
    8.14