Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+7 -5
+5 -3
drivers/mtd/devices/block2mtd.c
··· 241 241 { 242 242 struct block_device *bdev; 243 243 struct block2mtd_dev *dev; 244 + char *name; 244 245 245 246 if (!devname) 246 247 return NULL; ··· 280 279 281 280 /* Setup the MTD structure */ 282 281 /* make the name contain the block device in */ 283 - dev->mtd.name = kmalloc(sizeof("block2mtd: ") + strlen(devname), 282 + name = kmalloc(sizeof("block2mtd: ") + strlen(devname) + 1, 284 283 GFP_KERNEL); 285 - if (!dev->mtd.name) 284 + if (!name) 286 285 goto devinit_err; 287 286 288 - sprintf(dev->mtd.name, "block2mtd: %s", devname); 287 + sprintf(name, "block2mtd: %s", devname); 288 + dev->mtd.name = name; 289 289 290 290 dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK; 291 291 dev->mtd.erasesize = erase_size;
+1 -1
include/linux/mtd/map.h
··· 189 189 */ 190 190 191 191 struct map_info { 192 - char *name; 192 + const char *name; 193 193 unsigned long size; 194 194 resource_size_t phys; 195 195 #define NO_XIP (-1UL)
+1 -1
include/linux/mtd/mtd.h
··· 121 121 u_int32_t oobavail; // Available OOB bytes per block 122 122 123 123 // Kernel-only stuff starts here. 124 - char *name; 124 + const char *name; 125 125 int index; 126 126 127 127 /* ecc layout structure pointer - read only ! */