From snakebyte@gmx.de Wed Feb 22 02:18:18 2006 From: Eric Sesterhenn Subject: sysfs: kzalloc conversion Cc: gregkh@suse.de Date: Wed, 22 Feb 2006 11:18:15 +0100 Message-Id: <1140603496.14898.20.camel@alice> this converts fs/sysfs to kzalloc() usage. compile tested with make allyesconfig Signed-off-by: Eric Sesterhenn Signed-off-by: Greg Kroah-Hartman --- fs/sysfs/file.c | 3 +-- fs/sysfs/inode.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) --- gregkh-2.6.orig/fs/sysfs/file.c +++ gregkh-2.6/fs/sysfs/file.c @@ -305,9 +305,8 @@ static int check_perm(struct inode * ino /* No error? Great, allocate a buffer for the file, and store it * it in file->private_data for easy access. */ - buffer = kmalloc(sizeof(struct sysfs_buffer),GFP_KERNEL); + buffer = kzalloc(sizeof(struct sysfs_buffer), GFP_KERNEL); if (buffer) { - memset(buffer,0,sizeof(struct sysfs_buffer)); init_MUTEX(&buffer->sem); buffer->needs_read_fill = 1; buffer->ops = ops; --- gregkh-2.6.orig/fs/sysfs/inode.c +++ gregkh-2.6/fs/sysfs/inode.c @@ -54,11 +54,10 @@ int sysfs_setattr(struct dentry * dentry if (!sd_iattr) { /* setting attributes for the first time, allocate now */ - sd_iattr = kmalloc(sizeof(struct iattr), GFP_KERNEL); + sd_iattr = kzalloc(sizeof(struct iattr), GFP_KERNEL); if (!sd_iattr) return -ENOMEM; /* assign default attributes */ - memset(sd_iattr, 0, sizeof(struct iattr)); sd_iattr->ia_mode = sd->s_mode; sd_iattr->ia_uid = 0; sd_iattr->ia_gid = 0;