linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 35/87] mtd: nand: replace kmalloc and memset with kzalloc in nand_bch.c
@ 2019-06-27 17:39 Fuqian Huang
  2019-06-27 17:46 ` Miquel Raynal
  0 siblings, 1 reply; 2+ messages in thread
From: Fuqian Huang @ 2019-06-27 17:39 UTC (permalink / raw)
  Cc: Fuqian Huang, Miquel Raynal, Richard Weinberger, David Woodhouse,
	Brian Norris, Marek Vasut, Vignesh Raghavendra, Boris Brezillon,
	Kate Stewart, Thomas Gleixner, linux-mtd, linux-kernel

kmalloc + memset(0) -> kzalloc

Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
---
 drivers/mtd/nand/raw/nand_bch.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/raw/nand_bch.c b/drivers/mtd/nand/raw/nand_bch.c
index 55aa4c1cd414..17527310c3a1 100644
--- a/drivers/mtd/nand/raw/nand_bch.c
+++ b/drivers/mtd/nand/raw/nand_bch.c
@@ -170,7 +170,7 @@ struct nand_bch_control *nand_bch_init(struct mtd_info *mtd)
 		goto fail;
 	}
 
-	nbc->eccmask = kmalloc(eccbytes, GFP_KERNEL);
+	nbc->eccmask = kzalloc(eccbytes, GFP_KERNEL);
 	nbc->errloc = kmalloc_array(t, sizeof(*nbc->errloc), GFP_KERNEL);
 	if (!nbc->eccmask || !nbc->errloc)
 		goto fail;
@@ -182,7 +182,6 @@ struct nand_bch_control *nand_bch_init(struct mtd_info *mtd)
 		goto fail;
 
 	memset(erased_page, 0xff, eccsize);
-	memset(nbc->eccmask, 0, eccbytes);
 	encode_bch(nbc->bch, erased_page, eccsize, nbc->eccmask);
 	kfree(erased_page);
 
-- 
2.11.0


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

* Re: [PATCH 35/87] mtd: nand: replace kmalloc and memset with kzalloc in nand_bch.c
  2019-06-27 17:39 [PATCH 35/87] mtd: nand: replace kmalloc and memset with kzalloc in nand_bch.c Fuqian Huang
@ 2019-06-27 17:46 ` Miquel Raynal
  0 siblings, 0 replies; 2+ messages in thread
From: Miquel Raynal @ 2019-06-27 17:46 UTC (permalink / raw)
  To: Fuqian Huang
  Cc: Richard Weinberger, David Woodhouse, Brian Norris, Marek Vasut,
	Vignesh Raghavendra, Boris Brezillon, Kate Stewart,
	Thomas Gleixner, linux-mtd, linux-kernel

Hi Fuqian,

Fuqian Huang <huangfq.daxian@gmail.com> wrote on Fri, 28 Jun 2019
01:39:05 +0800:

> kmalloc + memset(0) -> kzalloc
> 
> Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
> ---
>  drivers/mtd/nand/raw/nand_bch.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/nand_bch.c b/drivers/mtd/nand/raw/nand_bch.c
> index 55aa4c1cd414..17527310c3a1 100644
> --- a/drivers/mtd/nand/raw/nand_bch.c
> +++ b/drivers/mtd/nand/raw/nand_bch.c
> @@ -170,7 +170,7 @@ struct nand_bch_control *nand_bch_init(struct mtd_info *mtd)
>  		goto fail;
>  	}
>  
> -	nbc->eccmask = kmalloc(eccbytes, GFP_KERNEL);
> +	nbc->eccmask = kzalloc(eccbytes, GFP_KERNEL);
>  	nbc->errloc = kmalloc_array(t, sizeof(*nbc->errloc), GFP_KERNEL);
>  	if (!nbc->eccmask || !nbc->errloc)
>  		goto fail;
> @@ -182,7 +182,6 @@ struct nand_bch_control *nand_bch_init(struct mtd_info *mtd)
>  		goto fail;
>  
>  	memset(erased_page, 0xff, eccsize);
> -	memset(nbc->eccmask, 0, eccbytes);
>  	encode_bch(nbc->bch, erased_page, eccsize, nbc->eccmask);
>  	kfree(erased_page);
>  

Are there any guidelines on this topic that I missed? Otherwise I don't
think this is important to change.


Thanks,
Miquèl

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

end of thread, other threads:[~2019-06-27 17:46 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:39 [PATCH 35/87] mtd: nand: replace kmalloc and memset with kzalloc in nand_bch.c Fuqian Huang
2019-06-27 17:46 ` Miquel Raynal

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).