mtd_info: name is const most of the time
Subsystems (2)
PATCH 1/1 mtd_info: name is const most of the time
There is only one special case - block2mtd, which fills name via sprintf. So use casting there, we know it's safe.
Signed-off-by Anton Vorontsov <[email protected]>
--- drivers/mtd/cmdlinepart.c | 2 +- drivers/mtd/devices/block2mtd.c | 2 +- drivers/mtd/mtdconcat.c | 2 +- include/linux/mtd/concat.h | 2 +- include/linux/mtd/mtd.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
drivers/mtd/cmdlinepart.c +1 -1
@@ -299,7 +299,7 @@ static int parse_cmdline_partitions(struct mtd_info *master,unsigned long offset;int i;struct cmdline_mtd_partition *part; -char *mtd_id = master->name; +const char *mtd_id = master->name;if (!cmdline)return -EINVAL ;
drivers/mtd/devices/block2mtd.c +1 -1
@@ -284,7 +284,7 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size)if (!dev->mtd.name) goto devinit_err; -sprintf (dev->mtd.name,"block2mtd: %s" , devname); +sprintf ((char *)dev->mtd.name,"block2mtd: %s" , devname); dev->mtd.size = dev->blkdev->bd_inode->i_size &PAGE_MASK ; dev->mtd.erasesize = erase_size;
drivers/mtd/mtdconcat.c +1 -1
@@ -693,7 +693,7 @@ static int concat_block_markbad(struct mtd_info *mtd, loff_t ofs)*/ struct mtd_info *mtd_concat_create (struct mtd_info *subdev[],/* subdevices to concatenate */ int num_devs,/* number of subdevices */ -char *name) +const char *name) {/* name for the new device */ int i;size_t size;
include/linux/mtd/concat.h +1 -1
@@ -15,7 +15,7 @@struct mtd_info *mtd_concat_create (struct mtd_info *subdev[],/* subdevices to concatenate */ int num_devs,/* number of subdevices */ -char *name);/* name for the new device */ +const char *name);/* name for the new device */ void mtd_concat_destroy (struct mtd_info *mtd);
include/linux/mtd/mtd.h +1 -1
@@ -121,7 +121,7 @@ struct mtd_info {u_int32_t oobavail;// Available OOB bytes per block // Kernel-only stuff starts here. -char *name; +const char *name;int index;/* ecc layout structure pointer - read only ! */
Signature · 1 line
1.5.1.1-dirty