Commit 22abf318 authored by Haowen Bai's avatar Haowen Bai Committed by Richard Weinberger

jffs2: Use kzalloc instead of kmalloc/memset

Use kzalloc rather than duplicating its implementation, which
makes code simple and easy to understand.
Signed-off-by: default avatarHaowen Bai <baihaowen@meizu.com>
[rw: Fixed printk string]
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent 42226c98
...@@ -43,9 +43,9 @@ static void jffs2_erase_block(struct jffs2_sb_info *c, ...@@ -43,9 +43,9 @@ static void jffs2_erase_block(struct jffs2_sb_info *c,
jffs2_dbg(1, "%s(): erase block %#08x (range %#08x-%#08x)\n", jffs2_dbg(1, "%s(): erase block %#08x (range %#08x-%#08x)\n",
__func__, __func__,
jeb->offset, jeb->offset, jeb->offset + c->sector_size); jeb->offset, jeb->offset, jeb->offset + c->sector_size);
instr = kmalloc(sizeof(struct erase_info), GFP_KERNEL); instr = kzalloc(sizeof(struct erase_info), GFP_KERNEL);
if (!instr) { if (!instr) {
pr_warn("kmalloc for struct erase_info in jffs2_erase_block failed. Refiling block for later\n"); pr_warn("kzalloc for struct erase_info in jffs2_erase_block failed. Refiling block for later\n");
mutex_lock(&c->erase_free_sem); mutex_lock(&c->erase_free_sem);
spin_lock(&c->erase_completion_lock); spin_lock(&c->erase_completion_lock);
list_move(&jeb->list, &c->erase_pending_list); list_move(&jeb->list, &c->erase_pending_list);
...@@ -57,8 +57,6 @@ static void jffs2_erase_block(struct jffs2_sb_info *c, ...@@ -57,8 +57,6 @@ static void jffs2_erase_block(struct jffs2_sb_info *c,
return; return;
} }
memset(instr, 0, sizeof(*instr));
instr->addr = jeb->offset; instr->addr = jeb->offset;
instr->len = c->sector_size; instr->len = c->sector_size;
......
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