diff options
author | Fuqian Huang <huangfq.daxian@gmail.com> | 2019-06-28 10:48:13 +0800 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2019-06-28 12:00:46 +0200 |
commit | 17c929e1334ee0647ce9f3aba1d6bc645c1e5206 (patch) | |
tree | fc65fc4284ea61fef8b1efd5de61a68d05e69dc8 /drivers/mtd | |
parent | b83408b580eccf8d2797cd6cb9ae42c2a28656a7 (diff) | |
download | linux-17c929e1334ee0647ce9f3aba1d6bc645c1e5206.tar.gz linux-17c929e1334ee0647ce9f3aba1d6bc645c1e5206.tar.bz2 linux-17c929e1334ee0647ce9f3aba1d6bc645c1e5206.zip |
mtd: rawnand: Use kzalloc() instead of kmalloc() and memset()
Replace kmalloc() by a memset() followed with a kzalloc().
There is a recommendation to use zeroing allocator
rather than allocator followed by memset(0) in
./scripts/coccinelle/api/alloc/zalloc-simple.cocci
Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/raw/nand_bch.c | 3 |
1 files changed, 1 insertions, 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); |