Commit 40953ed8 authored by Jes Sorensen's avatar Jes Sorensen Committed by Linus Torvalds

[PATCH] snsc kmalloc2kzalloc

Change driver to use kzalloc rather than kmalloc+memset
Signed-off-by: default avatarJes Sorensen <jes@sgi.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 6b9438e1
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* License. See the file "COPYING" in the main directory of this archive * License. See the file "COPYING" in the main directory of this archive
* for more details. * for more details.
* *
* Copyright (C) 2004 Silicon Graphics, Inc. All rights reserved. * Copyright (C) 2004, 2006 Silicon Graphics, Inc. All rights reserved.
*/ */
/* /*
...@@ -77,7 +77,7 @@ scdrv_open(struct inode *inode, struct file *file) ...@@ -77,7 +77,7 @@ scdrv_open(struct inode *inode, struct file *file)
scd = container_of(inode->i_cdev, struct sysctl_data_s, scd_cdev); scd = container_of(inode->i_cdev, struct sysctl_data_s, scd_cdev);
/* allocate memory for subchannel data */ /* allocate memory for subchannel data */
sd = kmalloc(sizeof (struct subch_data_s), GFP_KERNEL); sd = kzalloc(sizeof (struct subch_data_s), GFP_KERNEL);
if (sd == NULL) { if (sd == NULL) {
printk("%s: couldn't allocate subchannel data\n", printk("%s: couldn't allocate subchannel data\n",
__FUNCTION__); __FUNCTION__);
...@@ -85,7 +85,6 @@ scdrv_open(struct inode *inode, struct file *file) ...@@ -85,7 +85,6 @@ scdrv_open(struct inode *inode, struct file *file)
} }
/* initialize subch_data_s fields */ /* initialize subch_data_s fields */
memset(sd, 0, sizeof (struct subch_data_s));
sd->sd_nasid = scd->scd_nasid; sd->sd_nasid = scd->scd_nasid;
sd->sd_subch = ia64_sn_irtr_open(scd->scd_nasid); sd->sd_subch = ia64_sn_irtr_open(scd->scd_nasid);
...@@ -394,7 +393,7 @@ scdrv_init(void) ...@@ -394,7 +393,7 @@ scdrv_init(void)
sprintf(devnamep, "#%d", geo_slab(geoid)); sprintf(devnamep, "#%d", geo_slab(geoid));
/* allocate sysctl device data */ /* allocate sysctl device data */
scd = kmalloc(sizeof (struct sysctl_data_s), scd = kzalloc(sizeof (struct sysctl_data_s),
GFP_KERNEL); GFP_KERNEL);
if (!scd) { if (!scd) {
printk("%s: failed to allocate device info" printk("%s: failed to allocate device info"
...@@ -402,7 +401,6 @@ scdrv_init(void) ...@@ -402,7 +401,6 @@ scdrv_init(void)
SYSCTL_BASENAME, devname); SYSCTL_BASENAME, devname);
continue; continue;
} }
memset(scd, 0, sizeof (struct sysctl_data_s));
/* initialize sysctl device data fields */ /* initialize sysctl device data fields */
scd->scd_nasid = cnodeid_to_nasid(cnode); scd->scd_nasid = cnodeid_to_nasid(cnode);
......
...@@ -287,7 +287,7 @@ scdrv_event_init(struct sysctl_data_s *scd) ...@@ -287,7 +287,7 @@ scdrv_event_init(struct sysctl_data_s *scd)
{ {
int rv; int rv;
event_sd = kmalloc(sizeof (struct subch_data_s), GFP_KERNEL); event_sd = kzalloc(sizeof (struct subch_data_s), GFP_KERNEL);
if (event_sd == NULL) { if (event_sd == NULL) {
printk(KERN_WARNING "%s: couldn't allocate subchannel info" printk(KERN_WARNING "%s: couldn't allocate subchannel info"
" for event monitoring\n", __FUNCTION__); " for event monitoring\n", __FUNCTION__);
...@@ -295,7 +295,6 @@ scdrv_event_init(struct sysctl_data_s *scd) ...@@ -295,7 +295,6 @@ scdrv_event_init(struct sysctl_data_s *scd)
} }
/* initialize subch_data_s fields */ /* initialize subch_data_s fields */
memset(event_sd, 0, sizeof (struct subch_data_s));
event_sd->sd_nasid = scd->scd_nasid; event_sd->sd_nasid = scd->scd_nasid;
spin_lock_init(&event_sd->sd_rlock); spin_lock_init(&event_sd->sd_rlock);
...@@ -321,5 +320,3 @@ scdrv_event_init(struct sysctl_data_s *scd) ...@@ -321,5 +320,3 @@ scdrv_event_init(struct sysctl_data_s *scd)
return; return;
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment