mtd: nandsim: use kasprintf()
authorAkinobu Mita <akinobu.mita@gmail.com>
Sun, 28 Jul 2013 02:21:54 +0000 (11:21 +0900)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Mon, 5 Aug 2013 20:05:24 +0000 (21:05 +0100)
Use kasprintf() which combines kmalloc and sprintf.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/nand/nandsim.c

index a73dce0208164450cd679cb3a7a2a641f3dafef4..ac1b46cbd33e58a1c0c59fe1d06491e7dc5a8e11 100644 (file)
@@ -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);
 }
 
 /*