mtd: maps: Remove BUS_ID_SIZE from integrator_flash

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Wed Jun 24 11:59:01 EDT 2009


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=17659c60629618c0aa67eb3cb6a77d2c52486d2e
Commit:     17659c60629618c0aa67eb3cb6a77d2c52486d2e
Parent:     4839641333d4593bfc4fb29aa3af10d36f607d5b
Author:     David Woodhouse <David.Woodhouse at intel.com>
AuthorDate: Wed Jun 24 15:35:15 2009 +0100
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Wed Jun 24 16:02:06 2009 +0100

    mtd: maps: Remove BUS_ID_SIZE from integrator_flash
    
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
    Tested-by: Catalin Marinas <catalin.marinas at arm.com>
---
 drivers/mtd/maps/integrator-flash.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/mtd/maps/integrator-flash.c b/drivers/mtd/maps/integrator-flash.c
index b08a798..2aac41b 100644
--- a/drivers/mtd/maps/integrator-flash.c
+++ b/drivers/mtd/maps/integrator-flash.c
@@ -42,10 +42,8 @@
 #include <mach/hardware.h>
 #include <asm/system.h>
 
-#define SUBDEV_NAME_SIZE	(BUS_ID_SIZE + 2)
-
 struct armflash_subdev_info {
-	char			name[SUBDEV_NAME_SIZE];
+	char			*name;
 	struct mtd_info		*mtd;
 	struct map_info		map;
 	struct flash_platform_data *plat;
@@ -134,6 +132,8 @@ static void armflash_subdev_remove(struct armflash_subdev_info *subdev)
 		map_destroy(subdev->mtd);
 	if (subdev->map.virt)
 		iounmap(subdev->map.virt);
+	kfree(subdev->name);
+	subdev->name = NULL;
 	release_mem_region(subdev->map.phys, subdev->map.size);
 }
 
@@ -177,16 +177,22 @@ static int armflash_probe(struct platform_device *dev)
 
 		if (nr == 1)
 			/* No MTD concatenation, just use the default name */
-			snprintf(subdev->name, SUBDEV_NAME_SIZE, "%s",
-				 dev_name(&dev->dev));
+			subdev->name = kstrdup(dev_name(&dev->dev), GFP_KERNEL);
 		else
-			snprintf(subdev->name, SUBDEV_NAME_SIZE, "%s-%d",
-				 dev_name(&dev->dev), i);
+			subdev->name = kasprintf(GFP_KERNEL, "%s-%d",
+						 dev_name(&dev->dev), i);
+		if (!subdev->name) {
+			err = -ENOMEM;
+			break;
+		}
 		subdev->plat = plat;
 
 		err = armflash_subdev_probe(subdev, res);
-		if (err)
+		if (err) {
+			kfree(subdev->name);
+			subdev->name = NULL;
 			break;
+		}
 	}
 	info->nr_subdev = i;
 



More information about the linux-mtd-cvs mailing list