linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: tests: consolidate kmalloc/memset 0 call to kzalloc
@ 2015-12-31 15:21 Nicholas Mc Guire
  2016-01-06 23:18 ` Brian Norris
  0 siblings, 1 reply; 2+ messages in thread
From: Nicholas Mc Guire @ 2015-12-31 15:21 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Brian Norris, Richard Weinberger, linux-mtd, linux-kernel,
	Nicholas Mc Guire

This is an API consolidation only. The use of kmalloc + memset to 0
is equivalent to kzalloc.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---

Found by coccinelle script (relaxed version of
scripts/coccinelle/api/alloc/kzalloc-simple.cocci)

Patch was compile tested with: nhk8815_defconfig
(implies CONFIG_MTD_TESTS=m)

Patch is against linux-next (localversion-next is -next-20151231)

 drivers/mtd/tests/pagetest.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mtd/tests/pagetest.c b/drivers/mtd/tests/pagetest.c
index ba1890d..ff1e056 100644
--- a/drivers/mtd/tests/pagetest.c
+++ b/drivers/mtd/tests/pagetest.c
@@ -127,13 +127,12 @@ static int crosstest(void)
 	unsigned char *pp1, *pp2, *pp3, *pp4;
 
 	pr_info("crosstest\n");
-	pp1 = kmalloc(pgsize * 4, GFP_KERNEL);
+	pp1 = kzalloc(pgsize * 4, GFP_KERNEL);
 	if (!pp1)
 		return -ENOMEM;
 	pp2 = pp1 + pgsize;
 	pp3 = pp2 + pgsize;
 	pp4 = pp3 + pgsize;
-	memset(pp1, 0, pgsize * 4);
 
 	addr0 = 0;
 	for (i = 0; i < ebcnt && bbt[i]; ++i)
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mtd: tests: consolidate kmalloc/memset 0 call to kzalloc
  2015-12-31 15:21 [PATCH] mtd: tests: consolidate kmalloc/memset 0 call to kzalloc Nicholas Mc Guire
@ 2016-01-06 23:18 ` Brian Norris
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Norris @ 2016-01-06 23:18 UTC (permalink / raw)
  To: Nicholas Mc Guire
  Cc: David Woodhouse, Richard Weinberger, linux-mtd, linux-kernel

On Thu, Dec 31, 2015 at 04:21:22PM +0100, Nicholas Mc Guire wrote:
> This is an API consolidation only. The use of kmalloc + memset to 0
> is equivalent to kzalloc.
> 
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>

Applied to l2-mtd.git

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-06 23:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-31 15:21 [PATCH] mtd: tests: consolidate kmalloc/memset 0 call to kzalloc Nicholas Mc Guire
2016-01-06 23:18 ` Brian Norris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).