linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 44/87] fs: jffs2: replace kmalloc and memset with kzalloc
@ 2019-06-27 17:41 Fuqian Huang
  2019-06-28  6:56 ` Richard Weinberger
  0 siblings, 1 reply; 2+ messages in thread
From: Fuqian Huang @ 2019-06-27 17:41 UTC (permalink / raw)
  Cc: Fuqian Huang, David Woodhouse, Richard Weinberger, linux-mtd,
	linux-kernel

kmalloc + memset(0) -> kzalloc

Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
---
 fs/jffs2/erase.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c
index 83b8f06b4a64..30c4385c6545 100644
--- a/fs/jffs2/erase.c
+++ b/fs/jffs2/erase.c
@@ -43,7 +43,7 @@ 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");
 		mutex_lock(&c->erase_free_sem);
@@ -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;
 
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 44/87] fs: jffs2: replace kmalloc and memset with kzalloc
  2019-06-27 17:41 [PATCH 44/87] fs: jffs2: replace kmalloc and memset with kzalloc Fuqian Huang
@ 2019-06-28  6:56 ` Richard Weinberger
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Weinberger @ 2019-06-28  6:56 UTC (permalink / raw)
  To: Fuqian Huang; +Cc: David Woodhouse, linux-mtd, linux-kernel

----- Ursprüngliche Mail -----
> Von: "Fuqian Huang" <huangfq.daxian@gmail.com>
> CC: "Fuqian Huang" <huangfq.daxian@gmail.com>, "David Woodhouse" <dwmw2@infradead.org>, "richard" <richard@nod.at>,
> "linux-mtd" <linux-mtd@lists.infradead.org>, "linux-kernel" <linux-kernel@vger.kernel.org>
> Gesendet: Donnerstag, 27. Juni 2019 19:41:00
> Betreff: [PATCH 44/87] fs: jffs2: replace kmalloc and memset with kzalloc

> kmalloc + memset(0) -> kzalloc
> 
> Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
> ---
> fs/jffs2/erase.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c
> index 83b8f06b4a64..30c4385c6545 100644
> --- a/fs/jffs2/erase.c
> +++ b/fs/jffs2/erase.c
> @@ -43,7 +43,7 @@ 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");

You missed this "kmalloc" instance. :-D

> 		mutex_lock(&c->erase_free_sem);
> @@ -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;

Thanks,
//richard

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-28  6:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-27 17:41 [PATCH 44/87] fs: jffs2: replace kmalloc and memset with kzalloc Fuqian Huang
2019-06-28  6:56 ` Richard Weinberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).