aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/devices/block2mtd.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2008-07-02 15:46:22 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-07-22 00:55:03 -0400
commiteadcf0d704a46979c29984fa05f1fc413c775bcb (patch)
tree79d417f4d98321929bde702fe1ff7f13ed27f465 /drivers/mtd/devices/block2mtd.c
parent89bcb05d9bbf8bd559988bca4f2579defd28d008 (diff)
MTD: handle pci_name() being const
This changes the MTD core to handle pci_name() now returning a constant string. Cc: David Woodhouse <dwmw2@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/mtd/devices/block2mtd.c')
-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 519d942e7940..7b72a1b36115 100644
--- a/drivers/mtd/devices/block2mtd.c
+++ b/drivers/mtd/devices/block2mtd.c
@@ -241,6 +241,7 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size)
241{ 241{
242 struct block_device *bdev; 242 struct block_device *bdev;
243 struct block2mtd_dev *dev; 243 struct block2mtd_dev *dev;
244 char *name;
244 245
245 if (!devname) 246 if (!devname)
246 return NULL; 247 return NULL;
@@ -279,12 +280,13 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size)
279 280
280 /* Setup the MTD structure */ 281 /* Setup the MTD structure */
281 /* make the name contain the block device in */ 282 /* make the name contain the block device in */
282 dev->mtd.name = kmalloc(sizeof("block2mtd: ") + strlen(devname), 283 name = kmalloc(sizeof("block2mtd: ") + strlen(devname) + 1,
283 GFP_KERNEL); 284 GFP_KERNEL);
284 if (!dev->mtd.name) 285 if (!name)
285 goto devinit_err; 286 goto devinit_err;
286 287
287 sprintf(dev->mtd.name, "block2mtd: %s", devname); 288 sprintf(name, "block2mtd: %s", devname);
289 dev->mtd.name = name;
288 290
289 dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK; 291 dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK;
290 dev->mtd.erasesize = erase_size; 292 dev->mtd.erasesize = erase_size;