[35/87] mtd: nand: replace kmalloc and memset with kzalloc in nand_bch.c
diff mbox series

Message ID 20190627173906.3675-1-huangfq.daxian@gmail.com
State Rejected
Delegated to: Miquel Raynal
Headers show
Series
  • Untitled series #116519
Related show

Commit Message

Fuqian Huang June 27, 2019, 5:39 p.m. UTC
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(-)

Comments

Miquel Raynal June 27, 2019, 5:46 p.m. UTC | #1
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

Patch
diff mbox series

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