summaryrefslogtreecommitdiffstats
path: root/fs/jffs2
diff options
context:
space:
mode:
authorHaowen Bai <baihaowen@meizu.com>2022-04-18 18:18:07 +0800
committerRichard Weinberger <richard@nod.at>2022-05-27 16:12:55 +0200
commit22abf318c35bcf642625e4eff56cfec1df361f3b (patch)
treef5d99e188cd02e6c7236cc2b97fc983db54fab80 /fs/jffs2
parent42226c989789d8da4af1de0c31070c96726d990c (diff)
downloadlinux-stable-22abf318c35bcf642625e4eff56cfec1df361f3b.tar.gz
linux-stable-22abf318c35bcf642625e4eff56cfec1df361f3b.tar.bz2
linux-stable-22abf318c35bcf642625e4eff56cfec1df361f3b.zip
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: Haowen Bai <baihaowen@meizu.com> [rw: Fixed printk string] Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'fs/jffs2')
-rw-r--r--fs/jffs2/erase.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c
index 7e9abdb89712..acd32f05b519 100644
--- a/fs/jffs2/erase.c
+++ b/fs/jffs2/erase.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",
__func__,
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) {
- 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);
spin_lock(&c->erase_completion_lock);
list_move(&jeb->list, &c->erase_pending_list);
@@ -57,8 +57,6 @@ static void jffs2_erase_block(struct jffs2_sb_info *c,
return;
}
- memset(instr, 0, sizeof(*instr));
-
instr->addr = jeb->offset;
instr->len = c->sector_size;