diff options
author | Jes Sorensen <jes@sgi.com> | 2006-03-23 06:00:49 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-23 10:38:15 -0500 |
commit | 40953ed87dd68742de0dd1bdecdcdfebfe1d69ae (patch) | |
tree | c5faa3efe1e3f8381d5d8674f068556abb9400d8 /drivers | |
parent | 6b9438e1323a2be10dcc039f6321e7ca18b9459e (diff) |
[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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/snsc.c | 8 | ||||
-rw-r--r-- | drivers/char/snsc_event.c | 5 |
2 files changed, 4 insertions, 9 deletions
diff --git a/drivers/char/snsc.c b/drivers/char/snsc.c index 0e7d216e7eb0..b543821d8cb4 100644 --- a/drivers/char/snsc.c +++ b/drivers/char/snsc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * License. See the file "COPYING" in the main directory of this archive | 5 | * License. See the file "COPYING" in the main directory of this archive |
6 | * for more details. | 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,7 +77,7 @@ scdrv_open(struct inode *inode, struct file *file) | |||
77 | scd = container_of(inode->i_cdev, struct sysctl_data_s, scd_cdev); | 77 | scd = container_of(inode->i_cdev, struct sysctl_data_s, scd_cdev); |
78 | 78 | ||
79 | /* allocate memory for subchannel data */ | 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 | if (sd == NULL) { | 81 | if (sd == NULL) { |
82 | printk("%s: couldn't allocate subchannel data\n", | 82 | printk("%s: couldn't allocate subchannel data\n", |
83 | __FUNCTION__); | 83 | __FUNCTION__); |
@@ -85,7 +85,6 @@ scdrv_open(struct inode *inode, struct file *file) | |||
85 | } | 85 | } |
86 | 86 | ||
87 | /* initialize subch_data_s fields */ | 87 | /* initialize subch_data_s fields */ |
88 | memset(sd, 0, sizeof (struct subch_data_s)); | ||
89 | sd->sd_nasid = scd->scd_nasid; | 88 | sd->sd_nasid = scd->scd_nasid; |
90 | sd->sd_subch = ia64_sn_irtr_open(scd->scd_nasid); | 89 | sd->sd_subch = ia64_sn_irtr_open(scd->scd_nasid); |
91 | 90 | ||
@@ -394,7 +393,7 @@ scdrv_init(void) | |||
394 | sprintf(devnamep, "#%d", geo_slab(geoid)); | 393 | sprintf(devnamep, "#%d", geo_slab(geoid)); |
395 | 394 | ||
396 | /* allocate sysctl device data */ | 395 | /* allocate sysctl device data */ |
397 | scd = kmalloc(sizeof (struct sysctl_data_s), | 396 | scd = kzalloc(sizeof (struct sysctl_data_s), |
398 | GFP_KERNEL); | 397 | GFP_KERNEL); |
399 | if (!scd) { | 398 | if (!scd) { |
400 | printk("%s: failed to allocate device info" | 399 | printk("%s: failed to allocate device info" |
@@ -402,7 +401,6 @@ scdrv_init(void) | |||
402 | SYSCTL_BASENAME, devname); | 401 | SYSCTL_BASENAME, devname); |
403 | continue; | 402 | continue; |
404 | } | 403 | } |
405 | memset(scd, 0, sizeof (struct sysctl_data_s)); | ||
406 | 404 | ||
407 | /* initialize sysctl device data fields */ | 405 | /* initialize sysctl device data fields */ |
408 | scd->scd_nasid = cnodeid_to_nasid(cnode); | 406 | scd->scd_nasid = cnodeid_to_nasid(cnode); |
diff --git a/drivers/char/snsc_event.c b/drivers/char/snsc_event.c index a4fa507eed9e..e234d50e142a 100644 --- a/drivers/char/snsc_event.c +++ b/drivers/char/snsc_event.c | |||
@@ -287,7 +287,7 @@ scdrv_event_init(struct sysctl_data_s *scd) | |||
287 | { | 287 | { |
288 | int rv; | 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 | if (event_sd == NULL) { | 291 | if (event_sd == NULL) { |
292 | printk(KERN_WARNING "%s: couldn't allocate subchannel info" | 292 | printk(KERN_WARNING "%s: couldn't allocate subchannel info" |
293 | " for event monitoring\n", __FUNCTION__); | 293 | " for event monitoring\n", __FUNCTION__); |
@@ -295,7 +295,6 @@ scdrv_event_init(struct sysctl_data_s *scd) | |||
295 | } | 295 | } |
296 | 296 | ||
297 | /* initialize subch_data_s fields */ | 297 | /* initialize subch_data_s fields */ |
298 | memset(event_sd, 0, sizeof (struct subch_data_s)); | ||
299 | event_sd->sd_nasid = scd->scd_nasid; | 298 | event_sd->sd_nasid = scd->scd_nasid; |
300 | spin_lock_init(&event_sd->sd_rlock); | 299 | spin_lock_init(&event_sd->sd_rlock); |
301 | 300 | ||
@@ -321,5 +320,3 @@ scdrv_event_init(struct sysctl_data_s *scd) | |||
321 | return; | 320 | return; |
322 | } | 321 | } |
323 | } | 322 | } |
324 | |||
325 | |||