[svn-commits] sruffell: linux/trunk r9568 - /linux/trunk/drivers/dahdi/dahdi_dynamic.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jan 3 18:25:13 UTC 2011


Author: sruffell
Date: Mon Jan  3 12:25:09 2011
New Revision: 9568

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9568
Log:
dahdi_dynamic: kmalloc/memset -> kzalloc

Signed-off-by: Shaun Ruffell <sruffell at digium.com>
Acked-by: Kinsey Moore <kmoore at digium.com>

Modified:
    linux/trunk/drivers/dahdi/dahdi_dynamic.c

Modified: linux/trunk/drivers/dahdi/dahdi_dynamic.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/dahdi_dynamic.c?view=diff&rev=9568&r1=9567&r2=9568
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi_dynamic.c (original)
+++ linux/trunk/drivers/dahdi/dahdi_dynamic.c Mon Jan  3 12:25:09 2011
@@ -549,36 +549,28 @@
 		return -EEXIST;
 
 	/* Allocate memory */
-	d = kmalloc(sizeof(*d), GFP_KERNEL);
+	d = kzalloc(sizeof(*d), GFP_KERNEL);
 	if (!d)
 		return -ENOMEM;
 
-	/* Zero it out */
-	memset(d, 0, sizeof(*d));
-
 	for (x = 0; x < dds->numchans; x++) {
-		d->chans[x] = kmalloc(sizeof(*d->chans[x]), GFP_KERNEL);
+		d->chans[x] = kzalloc(sizeof(*d->chans[x]), GFP_KERNEL);
 		if (!d->chans[x]) {
 			dynamic_destroy(d);
 			return -ENOMEM;
 		}
-
-		memset(d->chans[x], 0, sizeof(*d->chans[x]));
 	}
 
 	/* Allocate message buffer with sample space and header space */
 	bufsize = dds->numchans * DAHDI_CHUNKSIZE + dds->numchans / 4 + 48;
 
-	d->msgbuf = kmalloc(bufsize, GFP_KERNEL);
+	d->msgbuf = kzalloc(bufsize, GFP_KERNEL);
 
 	if (!d->msgbuf) {
 		dynamic_destroy(d);
 		return -ENOMEM;
 	}
 	
-	/* Zero out -- probably not needed but why not */
-	memset(d->msgbuf, 0, bufsize);
-
 	/* Setup parameters properly assuming we're going to be okay. */
 	dahdi_copy_string(d->dname, dds->driver, sizeof(d->dname));
 	dahdi_copy_string(d->addr, dds->addr, sizeof(d->addr));




More information about the svn-commits mailing list