aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/devices
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2008-07-25 10:40:14 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2008-07-25 10:40:14 -0400
commitff877ea80efa2015b6263766f78ee42c2a1b32f9 (patch)
tree85205005c611ab774702148558321c6fb92f1ccd /drivers/mtd/devices
parent30821fee4f0cb3e6d241d9f7ddc37742212e3eb7 (diff)
parentd37e6bf68fc1eb34a4ad21d9ae8890ed37ea80e7 (diff)
Merge branch 'linux-next' of git://git.infradead.org/~dedekind/ubi-2.6
Diffstat (limited to 'drivers/mtd/devices')
-rw-r--r--drivers/mtd/devices/block2mtd.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c
index 303ea9b8cfe4..91fbba767635 100644
--- a/drivers/mtd/devices/block2mtd.c
+++ b/drivers/mtd/devices/block2mtd.c
@@ -236,6 +236,7 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size)
236{ 236{
237 struct block_device *bdev; 237 struct block_device *bdev;
238 struct block2mtd_dev *dev; 238 struct block2mtd_dev *dev;
239 char *name;
239 240
240 if (!devname) 241 if (!devname)
241 return NULL; 242 return NULL;
@@ -274,12 +275,13 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size)
274 275
275 /* Setup the MTD structure */ 276 /* Setup the MTD structure */
276 /* make the name contain the block device in */ 277 /* make the name contain the block device in */
277 dev->mtd.name = kmalloc(sizeof("block2mtd: ") + strlen(devname), 278 name = kmalloc(sizeof("block2mtd: ") + strlen(devname) + 1,
278 GFP_KERNEL); 279 GFP_KERNEL);
279 if (!dev->mtd.name) 280 if (!name)
280 goto devinit_err; 281 goto devinit_err;
281 282
282 sprintf(dev->mtd.name, "block2mtd: %s", devname); 283 sprintf(name, "block2mtd: %s", devname);
284 dev->mtd.name = name;
283 285
284 dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK; 286 dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK;
285 dev->mtd.erasesize = erase_size; 287 dev->mtd.erasesize = erase_size;