Patch replaces the sequence of function calls kmalloc and memset with kzalloc Signed-off-by: Denis Kirjanov <kirjanov@xxxxxxxxx> --- --- cowloop.c.orig 2009-09-18 21:11:46.000000000 +0400 +++ cowloop.c 2009-09-19 09:20:23.000000000 +0400 @@ -2184,7 +2193,7 @@ cowlo_opencow(struct cowloop_device *cow /* ** reserve space in memory for the cowhead */ - cowdev->cowhead = kmalloc(MAPUNIT, GFP_KERNEL); + cowdev->cowhead = kzalloc(MAPUNIT, GFP_KERNEL); if (!cowdev->cowhead) { printk(KERN_ERR "cowloop - cannot get space for cowhead %d\n", @@ -2192,8 +2201,6 @@ cowlo_opencow(struct cowloop_device *cow return -ENOMEM; } - memset(cowdev->cowhead, 0, MAPUNIT); - DEBUGP(DCOW"cowloop - prepare cowhead....\n"); /* @@ -2340,7 +2347,7 @@ cowlo_opencow(struct cowloop_device *cow ** allocate space to store all pointers for the bitmap-chunks ** (initialize area with zeroes to allow proper undo) */ - cowdev->mapcache = kmalloc(cowdev->mapcount * sizeof(char *), + cowdev->mapcache = kzalloc(cowdev->mapcount * sizeof(char *), GFP_KERNEL); if (!cowdev->mapcache) { printk(KERN_ERR @@ -2348,7 +2355,6 @@ cowlo_opencow(struct cowloop_device *cow return -ENOMEM; } - memset(cowdev->mapcache, 0, cowdev->mapcount * sizeof(char *)); /* ** allocate space to store the bitmap-chunks themselves @@ -2596,7 +2602,7 @@ cowlo_init_module(void) } /* allocate room for a table with a pointer to each cowloop_device: */ - cowdevall = kmalloc(maxcows * sizeof(struct cowloop_device *), + cowdevall = kzalloc(maxcows * sizeof(struct cowloop_device *), GFP_KERNEL); if (cowdevall == NULL) { printk(KERN_WARNING @@ -2605,11 +2611,10 @@ cowlo_init_module(void) retval = -ENOMEM; goto error_out; } - memset(cowdevall, 0, maxcows * sizeof(struct cowloop_device *)); /* then hook an actual cowloop_device struct to each pointer: */ for (minor = 0; minor < maxcows; minor++) { cowdevall[minor] = - kmalloc(sizeof(struct cowloop_device), GFP_KERNEL); + kzalloc(sizeof(struct cowloop_device), GFP_KERNEL); if (cowdevall[minor] == NULL) { printk(KERN_WARNING "cowloop - can not alloc " "admin-struct for dev no %d\n", minor); @@ -2618,7 +2623,6 @@ cowlo_init_module(void) retval = -ENOMEM; goto error_out; } - memset(cowdevall[minor], 0, sizeof(struct cowloop_device)); } uptocows = maxcows; /* we got all devices */ _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel