Patchwork [2/6] mtd: nandsim: use kasprintf()

login
register
mail settings
Submitter Akinobu Mita
Date July 28, 2013, 2:21 a.m.
Message ID <1374978118-11418-2-git-send-email-akinobu.mita@gmail.com>
Download mbox | patch
Permalink /patch/262549/
State Accepted
Commit f03a5729287a8bc1eb061a2f849b5a33ed9cd3ab
Headers show

Comments

Akinobu Mita - July 28, 2013, 2:21 a.m.
Use kasprintf() which combines kmalloc and sprintf.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Brian Norris <computersforpeace@gmail.com>
Cc: Artem Bityutskiy <dedekind1@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: linux-mtd@lists.infradead.org
---
 drivers/mtd/nand/nandsim.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Patch

diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index a73dce0..ac1b46c 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -654,9 +654,7 @@  static void free_device(struct nandsim *ns)
 
 static char *get_partition_name(int i)
 {
-	char buf[64];
-	sprintf(buf, "NAND simulator partition %d", i);
-	return kstrdup(buf, GFP_KERNEL);
+	return kasprintf(GFP_KERNEL, "NAND simulator partition %d", i);
 }
 
 /*