Commit b593e48d authored by Yan Burman's avatar Yan Burman Committed by Linus Torvalds

[PATCH] affs: replace kmalloc+memset with kzalloc

Replace kmalloc+memset with kzalloc
Signed-off-by: default avatarYan Burman <burman.yan@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 4d2d3cec
...@@ -289,12 +289,11 @@ int affs_init_bitmap(struct super_block *sb, int *flags) ...@@ -289,12 +289,11 @@ int affs_init_bitmap(struct super_block *sb, int *flags)
sbi->s_bmap_count = (sbi->s_partition_size - sbi->s_reserved + sbi->s_bmap_count = (sbi->s_partition_size - sbi->s_reserved +
sbi->s_bmap_bits - 1) / sbi->s_bmap_bits; sbi->s_bmap_bits - 1) / sbi->s_bmap_bits;
size = sbi->s_bmap_count * sizeof(*bm); size = sbi->s_bmap_count * sizeof(*bm);
bm = sbi->s_bitmap = kmalloc(size, GFP_KERNEL); bm = sbi->s_bitmap = kzalloc(size, GFP_KERNEL);
if (!sbi->s_bitmap) { if (!sbi->s_bitmap) {
printk(KERN_ERR "AFFS: Bitmap allocation failed\n"); printk(KERN_ERR "AFFS: Bitmap allocation failed\n");
return -ENOMEM; return -ENOMEM;
} }
memset(sbi->s_bitmap, 0, size);
bmap_blk = (__be32 *)sbi->s_root_bh->b_data; bmap_blk = (__be32 *)sbi->s_root_bh->b_data;
blk = sb->s_blocksize / 4 - 49; blk = sb->s_blocksize / 4 - 49;
......
...@@ -55,13 +55,12 @@ int afs_server_lookup(struct afs_cell *cell, const struct in_addr *addr, ...@@ -55,13 +55,12 @@ int afs_server_lookup(struct afs_cell *cell, const struct in_addr *addr,
_enter("%p,%08x,", cell, ntohl(addr->s_addr)); _enter("%p,%08x,", cell, ntohl(addr->s_addr));
/* allocate and initialise a server record */ /* allocate and initialise a server record */
server = kmalloc(sizeof(struct afs_server), GFP_KERNEL); server = kzalloc(sizeof(struct afs_server), GFP_KERNEL);
if (!server) { if (!server) {
_leave(" = -ENOMEM"); _leave(" = -ENOMEM");
return -ENOMEM; return -ENOMEM;
} }
memset(server, 0, sizeof(struct afs_server));
atomic_set(&server->usage, 1); atomic_set(&server->usage, 1);
INIT_LIST_HEAD(&server->link); INIT_LIST_HEAD(&server->link);
......
...@@ -242,14 +242,12 @@ static int afs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -242,14 +242,12 @@ static int afs_fill_super(struct super_block *sb, void *data, int silent)
kenter(""); kenter("");
/* allocate a superblock info record */ /* allocate a superblock info record */
as = kmalloc(sizeof(struct afs_super_info), GFP_KERNEL); as = kzalloc(sizeof(struct afs_super_info), GFP_KERNEL);
if (!as) { if (!as) {
_leave(" = -ENOMEM"); _leave(" = -ENOMEM");
return -ENOMEM; return -ENOMEM;
} }
memset(as, 0, sizeof(struct afs_super_info));
afs_get_volume(params->volume); afs_get_volume(params->volume);
as->volume = params->volume; as->volume = params->volume;
......
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