Skip to contentSkip to conversation

mtd: spinand: Use 2-factor allocator calls

PATCH In review Kees Cook 2 participants 4 messages Jul 4, 2018 – Jul 8, 2018

Subsystems (2)
lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 mtd: spinand: Use 2-factor allocator calls

As already done treewide, switch from open-coded multiplication to using 2-factor allocator helpers.

---
 drivers/mtd/nand/spi/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/spi/core.c +2 -2
index 17d207a49cb9..fed9211c6f19 100644
@@ -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;
Signature · 6 lines
2.17.1


-- 
Kees Cook
Pixel Security
maintainer
#1 lore raw

Hello,

Kees Cook <[email protected]> wrote on Wed, 4 Jul 2018 10:27:59 -0700:

Quoted 5 lines

As already done treewide, switch from open-coded multiplication to using 2-factor allocator helpers.

---

Indeed, we'll be more careful about this in the future.

As this code has not been merged upstream yet, do you mind if I squash this with the initial patch?

Thanks,
Miquèl

author
#2 lore raw
Quoted 8 lines · Miquel Raynal

Hello,

Kees Cook <[email protected]> wrote on Wed, 4 Jul 2018 10:27:59 -0700:

Quoted 3 lines

As already done treewide, switch from open-coded multiplication to using 2-factor allocator helpers.

Quoted 7 lines
Quoted 2 lines

---

Indeed, we'll be more careful about this in the future.

As this code has not been merged upstream yet, do you mind if I squash this with the initial patch?

Totally fine by me! Thanks! :)

-Kees

Signature · 2 lines
Kees Cook
Pixel Security