Re: [PATCH 35/87] mtd: nand: replace kmalloc and memset with kzalloc in nand_bch.c

From: Miquel Raynal
Date: Thu Jun 27 2019 - 13:46:59 EST


Hi Fuqian,

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

> kmalloc + memset(0) -> kzalloc
>
> Signed-off-by: Fuqian Huang <huangfq.daxian@xxxxxxxxx>
> ---
> 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