diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2008-07-02 19:46:22 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-07-22 04:55:03 (GMT) |
commit | eadcf0d704a46979c29984fa05f1fc413c775bcb (patch) | |
tree | 79d417f4d98321929bde702fe1ff7f13ed27f465 /drivers | |
parent | 89bcb05d9bbf8bd559988bca4f2579defd28d008 (diff) | |
download | linux-eadcf0d704a46979c29984fa05f1fc413c775bcb.tar.xz |
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')
-rw-r--r-- | drivers/mtd/devices/block2mtd.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c index 519d942..7b72a1b 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) { struct block_device *bdev; struct block2mtd_dev *dev; + char *name; if (!devname) return NULL; @@ -279,12 +280,13 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size) /* Setup the MTD structure */ /* make the name contain the block device in */ - dev->mtd.name = kmalloc(sizeof("block2mtd: ") + strlen(devname), + name = kmalloc(sizeof("block2mtd: ") + strlen(devname) + 1, GFP_KERNEL); - if (!dev->mtd.name) + if (!name) goto devinit_err; - sprintf(dev->mtd.name, "block2mtd: %s", devname); + sprintf(name, "block2mtd: %s", devname); + dev->mtd.name = name; dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK; dev->mtd.erasesize = erase_size; |