lkml.org 
[lkml]   [2018]   [Jul]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] mtd: spinand: Use 2-factor allocator calls
As already done treewide, switch from open-coded multiplication to using
2-factor allocator helpers.

Signed-off-by: Kees Cook <keescook@chromium.org>
---
drivers/mtd/nand/spi/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index 17d207a49cb9..fed9211c6f19 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -159,9 +159,9 @@ static int spinand_init_cfg_cache(struct spinand_device *spinand)
unsigned int target;
int ret;

- spinand->cfg_cache = devm_kzalloc(dev,
- sizeof(*spinand->cfg_cache) *
+ spinand->cfg_cache = devm_kcalloc(dev,
nand->memorg.ntargets,
+ sizeof(*spinand->cfg_cache),
GFP_KERNEL);
if (!spinand->cfg_cache)
return -ENOMEM;
--
2.17.1

--
Kees Cook
Pixel Security

\
 
 \ /
  Last update: 2018-07-04 19:29    [W:0.867 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site