mtd: nandsim: use kasprintf()

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Aug 5 16:59:06 EDT 2013


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=f03a5729287a8bc1eb061a2f849b5a33ed9cd3ab
Commit:     f03a5729287a8bc1eb061a2f849b5a33ed9cd3ab
Parent:     08efe91a1befa67bcc3799e0d29b7194803e1538
Author:     Akinobu Mita <akinobu.mita at gmail.com>
AuthorDate: Sun Jul 28 11:21:54 2013 +0900
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Mon Aug 5 21:05:24 2013 +0100

    mtd: nandsim: use kasprintf()
    
    Use kasprintf() which combines kmalloc and sprintf.
    
    Signed-off-by: Akinobu Mita <akinobu.mita at gmail.com>
    Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/nand/nandsim.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

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);
 }
 
 /*



More information about the linux-mtd-cvs mailing list