MTD: make mtd->name const
Subsystems (2)
PATCH 1/1 MTD: make mtd->name const
mtd->name is never used read-write and often holds a pointer to constant data.
Signed-off-by Martin Waitz <[email protected]>
---
drivers/mtd/cmdlinepart.c | 2 +- drivers/mtd/devices/block2mtd.c | 10 +++++----- include/linux/mtd/mtd.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)
94152d03bf8d7a28519a8e7f6bf1b53c30664f8d
drivers/mtd/cmdlinepart.c +1 -1
@@ -300,7 +300,7 @@ static int parse_cmdline_partitions(struunsigned 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 +5 -5
@@ -289,6 +289,7 @@ static struct block2mtd_dev *add_device( {struct block_device *bdev;struct block2mtd_dev *dev; +char * name;if (!devname)return NULL ;
@@ -315,13 +316,12 @@ static struct block2mtd_dev *add_device(/* Setup the MTD structure */ /* make the name contain the block device in */ - dev->mtd.name =kmalloc (sizeof ("block2mtd: " ) +strlen (devname), -GFP_KERNEL ); -if (!dev->mtd.name) + name =kmalloc (sizeof ("block2mtd: " ) +strlen (devname),GFP_KERNEL ); +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; dev->mtd.type =MTD_RAM ;
include/linux/mtd/mtd.h +1 -1
@@ -84,7 +84,7 @@ #define MTD_PROGREGION_CTRLMODE_VALID(mt#define MTD_PROGREGION_CTRLMODE_INVALID (mtd) (mtd)->ecctype// Kernel-only stuff starts here. -char *name; +const char *name;int index;// oobinfo is a nand_oobinfo structure, which can be set by iotcl (MEMSETOOBINFO)
Signature · 4 lines
1.3.0.gc5417 -- Martin Waitz
Jörn Engel
AppliedQuoted 4 lines · Martin Waitz
mtd->nameis never used read-write and often holds a pointer to constant data.Signed-off-by Martin Waitz <[email protected]>
Applied, thanks.
Jörn
Signature · 4 lines
To my face you have the audacity to advise me to become a thief - the worst kind of thief that is conceivable, a thief of spiritual things, a thief of ideas! It is insufferable, intolerable! -- M. Binet in Scarabouche