aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/devices/block2mtd.c8
-rw-r--r--include/linux/mtd/map.h2
-rw-r--r--include/linux/mtd/mtd.h2
3 files changed, 7 insertions, 5 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;
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index a9fae032ba81..9c1d95491f8b 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -189,7 +189,7 @@ typedef union {
189*/ 189*/
190 190
191struct map_info { 191struct map_info {
192 char *name; 192 const char *name;
193 unsigned long size; 193 unsigned long size;
194 resource_size_t phys; 194 resource_size_t phys;
195#define NO_XIP (-1UL) 195#define NO_XIP (-1UL)
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 245f9098e171..8b5d49133ec6 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -121,7 +121,7 @@ struct mtd_info {
121 u_int32_t oobavail; // Available OOB bytes per block 121 u_int32_t oobavail; // Available OOB bytes per block
122 122
123 // Kernel-only stuff starts here. 123 // Kernel-only stuff starts here.
124 char *name; 124 const char *name;
125 int index; 125 int index;
126 126
127 /* ecc layout structure pointer - read only ! */ 127 /* ecc layout structure pointer - read only ! */