Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] snsc kmalloc2kzalloc

Change driver to use kzalloc rather than kmalloc+memset

Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Jes Sorensen and committed by
Linus Torvalds
40953ed8 6b9438e1

+4 -9
+3 -5
drivers/char/snsc.c
··· 5 5 * License. See the file "COPYING" in the main directory of this archive 6 6 * for more details. 7 7 * 8 - * Copyright (C) 2004 Silicon Graphics, Inc. All rights reserved. 8 + * Copyright (C) 2004, 2006 Silicon Graphics, Inc. All rights reserved. 9 9 */ 10 10 11 11 /* ··· 77 77 scd = container_of(inode->i_cdev, struct sysctl_data_s, scd_cdev); 78 78 79 79 /* allocate memory for subchannel data */ 80 - sd = kmalloc(sizeof (struct subch_data_s), GFP_KERNEL); 80 + sd = kzalloc(sizeof (struct subch_data_s), GFP_KERNEL); 81 81 if (sd == NULL) { 82 82 printk("%s: couldn't allocate subchannel data\n", 83 83 __FUNCTION__); ··· 85 85 } 86 86 87 87 /* initialize subch_data_s fields */ 88 - memset(sd, 0, sizeof (struct subch_data_s)); 89 88 sd->sd_nasid = scd->scd_nasid; 90 89 sd->sd_subch = ia64_sn_irtr_open(scd->scd_nasid); 91 90 ··· 393 394 sprintf(devnamep, "#%d", geo_slab(geoid)); 394 395 395 396 /* allocate sysctl device data */ 396 - scd = kmalloc(sizeof (struct sysctl_data_s), 397 + scd = kzalloc(sizeof (struct sysctl_data_s), 397 398 GFP_KERNEL); 398 399 if (!scd) { 399 400 printk("%s: failed to allocate device info" ··· 401 402 SYSCTL_BASENAME, devname); 402 403 continue; 403 404 } 404 - memset(scd, 0, sizeof (struct sysctl_data_s)); 405 405 406 406 /* initialize sysctl device data fields */ 407 407 scd->scd_nasid = cnodeid_to_nasid(cnode);
+1 -4
drivers/char/snsc_event.c
··· 287 287 { 288 288 int rv; 289 289 290 - event_sd = kmalloc(sizeof (struct subch_data_s), GFP_KERNEL); 290 + event_sd = kzalloc(sizeof (struct subch_data_s), GFP_KERNEL); 291 291 if (event_sd == NULL) { 292 292 printk(KERN_WARNING "%s: couldn't allocate subchannel info" 293 293 " for event monitoring\n", __FUNCTION__); ··· 295 295 } 296 296 297 297 /* initialize subch_data_s fields */ 298 - memset(event_sd, 0, sizeof (struct subch_data_s)); 299 298 event_sd->sd_nasid = scd->scd_nasid; 300 299 spin_lock_init(&event_sd->sd_rlock); 301 300 ··· 320 321 return; 321 322 } 322 323 } 323 - 324 -