Skip to contentSkip to conversation

USB AUERSWALD: replace kmalloc+memset with kzalloc

PATCH New Burman Yan 1 participant 1 message Nov 22, 2006 USB

lore
Share & tools
lore

Burman Yan

author
#0 lore raw

PATCH 1/1 USB AUERSWALD: replace kmalloc+memset with kzalloc

Hi.

This patch replaces kmalloc+memset with kzalloc in USB AUERSWALD driver.

Regards
Yan Burman

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

Replace kmalloc+memset with kzalloc

drivers/usb/misc/auerswald.c +2 -4
diff -rubp linux-2.6.19-rc5_orig/drivers/usb/misc/auerswald.c linux-2.6.19-rc5_kzalloc/drivers/usb/misc/auerswald.c
@@ -1379,7 +1379,7 @@ static int auerchar_open (struct inode *
 	}
 
 	/* we have access to the device. Now lets allocate memory */
-	ccp = (pauerchar_t) kmalloc(sizeof(auerchar_t), GFP_KERNEL);
+	ccp = kzalloc(sizeof(auerchar_t), GFP_KERNEL);
 	if (ccp == NULL) {
 		err ("out of memory");
 		ret = -ENOMEM;
@@ -1387,7 +1387,6 @@ static int auerchar_open (struct inode *
 	}
 
 	/* Initialize device descriptor */
-	memset( ccp, 0, sizeof(auerchar_t));
 	init_MUTEX( &ccp->mutex);
 	init_MUTEX( &ccp->readmutex);
         auerbuf_init (&ccp->bufctl);
@@ -1915,14 +1914,13 @@ static int auerswald_probe (struct usb_i
 		return -ENODEV;
 
 	/* allocate memory for our device and initialize it */
-	cp = kmalloc (sizeof(auerswald_t), GFP_KERNEL);
+	cp = kzalloc (sizeof(auerswald_t), GFP_KERNEL);
 	if (cp == NULL) {
 		err ("out of memory");
 		goto pfail;
 	}
 
 	/* Initialize device descriptor */
-	memset (cp, 0, sizeof(auerswald_t));
 	init_MUTEX (&cp->mutex);
 	cp->usbdev = usbdev;
 	auerchain_init (&cp->controlchain);