diff options
Diffstat (limited to 'drivers/mtd/devices/block2mtd.c')
-rw-r--r-- | drivers/mtd/devices/block2mtd.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c index ce6424008ed9..93651865ddbe 100644 --- a/drivers/mtd/devices/block2mtd.c +++ b/drivers/mtd/devices/block2mtd.c | |||
@@ -276,12 +276,10 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size) | |||
276 | 276 | ||
277 | /* Setup the MTD structure */ | 277 | /* Setup the MTD structure */ |
278 | /* make the name contain the block device in */ | 278 | /* make the name contain the block device in */ |
279 | name = kmalloc(sizeof("block2mtd: ") + strlen(devname) + 1, | 279 | name = kasprintf(GFP_KERNEL, "block2mtd: %s", devname); |
280 | GFP_KERNEL); | ||
281 | if (!name) | 280 | if (!name) |
282 | goto devinit_err; | 281 | goto devinit_err; |
283 | 282 | ||
284 | sprintf(name, "block2mtd: %s", devname); | ||
285 | dev->mtd.name = name; | 283 | dev->mtd.name = name; |
286 | 284 | ||
287 | dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK; | 285 | dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK; |