Commit d55849aa authored by Artem B. Bityutskiy's avatar Artem B. Bityutskiy Committed by Thomas Gleixner

[JFFS2] Use memset(struct) instead of nulling struct members one by one

Signed-off-by: default avatarArtem B. Bityutskiy <dedekind@infradead.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 2f0077e0
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* For licensing information, see the file 'LICENCE' in this directory. * For licensing information, see the file 'LICENCE' in this directory.
* *
* $Id: build.c,v 1.83 2005/09/21 15:52:33 dedekind Exp $ * $Id: build.c,v 1.84 2005/09/27 13:40:49 dedekind Exp $
* *
*/ */
...@@ -309,28 +309,25 @@ int jffs2_do_mount_fs(struct jffs2_sb_info *c) ...@@ -309,28 +309,25 @@ int jffs2_do_mount_fs(struct jffs2_sb_info *c)
{ {
int ret; int ret;
int i; int i;
int size;
c->free_size = c->flash_size; c->free_size = c->flash_size;
c->nr_blocks = c->flash_size / c->sector_size; c->nr_blocks = c->flash_size / c->sector_size;
size = sizeof(struct jffs2_eraseblock) * c->nr_blocks;
#ifndef __ECOS #ifndef __ECOS
if (jffs2_blocks_use_vmalloc(c)) if (jffs2_blocks_use_vmalloc(c))
c->blocks = vmalloc(sizeof(struct jffs2_eraseblock) * c->nr_blocks); c->blocks = vmalloc(size);
else else
#endif #endif
c->blocks = kmalloc(sizeof(struct jffs2_eraseblock) * c->nr_blocks, GFP_KERNEL); c->blocks = kmalloc(size, GFP_KERNEL);
if (!c->blocks) if (!c->blocks)
return -ENOMEM; return -ENOMEM;
memset(c->blocks, 0, size);
for (i=0; i<c->nr_blocks; i++) { for (i=0; i<c->nr_blocks; i++) {
INIT_LIST_HEAD(&c->blocks[i].list); INIT_LIST_HEAD(&c->blocks[i].list);
c->blocks[i].offset = i * c->sector_size; c->blocks[i].offset = i * c->sector_size;
c->blocks[i].free_size = c->sector_size; c->blocks[i].free_size = c->sector_size;
c->blocks[i].dirty_size = 0;
c->blocks[i].wasted_size = 0;
c->blocks[i].unchecked_size = 0;
c->blocks[i].used_size = 0;
c->blocks[i].first_node = NULL;
c->blocks[i].last_node = NULL;
c->blocks[i].bad_count = 0;
} }
INIT_LIST_HEAD(&c->clean_list); INIT_LIST_HEAD(&c->clean_list);
......
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