From 7a6cb0d5497418599d2125b670926b75e673861c Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Thu, 13 May 2010 22:00:05 +0200 Subject: Staging: Use kcalloc or kzalloc Use kcalloc or kzalloc rather than the combination of kmalloc and memset. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x,y,flags; statement S; type T; @@ x = - kmalloc + kcalloc ( - y * sizeof(T), + y, sizeof(T), flags); if (x == NULL) S -memset(x, 0, y * sizeof(T)); @@ expression x,size,flags; statement S; @@ -x = kmalloc(size,flags); +x = kzalloc(size,flags); if (x == NULL) S -memset(x, 0, size); // Signed-off-by: Julia Lawall --- drivers/staging/otus/zdusb.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers/staging/otus') diff --git a/drivers/staging/otus/zdusb.c b/drivers/staging/otus/zdusb.c index 6509bc565e65..2c799a250294 100644 --- a/drivers/staging/otus/zdusb.c +++ b/drivers/staging/otus/zdusb.c @@ -95,7 +95,7 @@ static int zfLnxProbe(struct usb_interface *interface, printk(KERN_NOTICE "USB 1.1 Host\n"); #endif - macp = kmalloc(sizeof(struct usbdrv_private), GFP_KERNEL); + macp = kzalloc(sizeof(struct usbdrv_private), GFP_KERNEL); if (!macp) { printk(KERN_ERR "out of memory allocating device structure\n"); @@ -103,9 +103,6 @@ static int zfLnxProbe(struct usb_interface *interface, goto fail; } - /* Zero the memory */ - memset(macp, 0, sizeof(struct usbdrv_private)); - net = alloc_etherdev(0); if (net == NULL) -- cgit v1.2.3