diff options
author | Eric Sesterhenn <snakebyte@gmx.de> | 2006-02-22 05:18:15 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-03-20 16:42:58 -0500 |
commit | 58d49283b87751f7af75e021a629dcddb027e8eb (patch) | |
tree | b553643f22a4a216e06c5ab1711a88d3df1e1e6a /fs/sysfs | |
parent | 03e88ae1b13dfdc8bbaa59b8198e1ca53aad12ac (diff) |
[PATCH] sysfs: kzalloc conversion
this converts fs/sysfs to kzalloc() usage.
compile tested with make allyesconfig
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/sysfs')
-rw-r--r-- | fs/sysfs/file.c | 3 | ||||
-rw-r--r-- | fs/sysfs/inode.c | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index d0e3d8495165..e21f4022feb8 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
@@ -301,9 +301,8 @@ static int check_perm(struct inode * inode, struct file * file) | |||
301 | /* No error? Great, allocate a buffer for the file, and store it | 301 | /* No error? Great, allocate a buffer for the file, and store it |
302 | * it in file->private_data for easy access. | 302 | * it in file->private_data for easy access. |
303 | */ | 303 | */ |
304 | buffer = kmalloc(sizeof(struct sysfs_buffer),GFP_KERNEL); | 304 | buffer = kzalloc(sizeof(struct sysfs_buffer), GFP_KERNEL); |
305 | if (buffer) { | 305 | if (buffer) { |
306 | memset(buffer,0,sizeof(struct sysfs_buffer)); | ||
307 | init_MUTEX(&buffer->sem); | 306 | init_MUTEX(&buffer->sem); |
308 | buffer->needs_read_fill = 1; | 307 | buffer->needs_read_fill = 1; |
309 | buffer->ops = ops; | 308 | buffer->ops = ops; |
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index 6beee6f6a674..4c29ac41ac3e 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c | |||
@@ -54,11 +54,10 @@ int sysfs_setattr(struct dentry * dentry, struct iattr * iattr) | |||
54 | 54 | ||
55 | if (!sd_iattr) { | 55 | if (!sd_iattr) { |
56 | /* setting attributes for the first time, allocate now */ | 56 | /* setting attributes for the first time, allocate now */ |
57 | sd_iattr = kmalloc(sizeof(struct iattr), GFP_KERNEL); | 57 | sd_iattr = kzalloc(sizeof(struct iattr), GFP_KERNEL); |
58 | if (!sd_iattr) | 58 | if (!sd_iattr) |
59 | return -ENOMEM; | 59 | return -ENOMEM; |
60 | /* assign default attributes */ | 60 | /* assign default attributes */ |
61 | memset(sd_iattr, 0, sizeof(struct iattr)); | ||
62 | sd_iattr->ia_mode = sd->s_mode; | 61 | sd_iattr->ia_mode = sd->s_mode; |
63 | sd_iattr->ia_uid = 0; | 62 | sd_iattr->ia_uid = 0; |
64 | sd_iattr->ia_gid = 0; | 63 | sd_iattr->ia_gid = 0; |