diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-11-08 07:04:29 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-11-08 07:04:29 -0500 |
commit | d50ffc585dbec04fb1d219d5e8523fe6055e706f (patch) | |
tree | 08004217b3b5b75d88d9b2ade272515f95cdc27e | |
parent | 85758777c2a227fd1541b6dd122a08ab79c347ce (diff) | |
parent | 98ee3fc7ef8395f8b7a379e6608aee91efc66d48 (diff) |
Merge tag 'mtd/fixes-for-4.20-rc2' of git://git.infradead.org/linux-mtd
Pull MTD fixes from Boris Brezillon:
"MTD changes:
- Kill a VLA in sa1100
SPI NOR changes:
- Make sure ->addr_width is restored when SFDP parsing fails
- Propate errors happening in cqspi_direct_read_execute()
NAND changes:
- Fix kernel-doc mismatch
- Fix nanddev_neraseblocks() to return the correct value
- Avoid selection of BCH_CONST_PARAMS when some users require dynamic
BCH settings"
* tag 'mtd/fixes-for-4.20-rc2' of git://git.infradead.org/linux-mtd:
mtd: nand: Fix nanddev_pos_next_page() kernel-doc header
mtd: sa1100: avoid VLA in sa1100_setup_mtd
mtd: spi-nor: Reset nor->addr_width when SFDP parsing failed
mtd: spi-nor: cadence-quadspi: Return error code in cqspi_direct_read_execute()
mtd: nand: Fix nanddev_neraseblocks()
mtd: nand: drop kernel-doc notation for a deleted function parameter
mtd: docg3: don't set conflicting BCH_CONST_PARAMS option
-rw-r--r-- | drivers/mtd/devices/Kconfig | 2 | ||||
-rw-r--r-- | drivers/mtd/maps/sa1100-flash.c | 10 | ||||
-rw-r--r-- | drivers/mtd/nand/raw/nand_base.c | 1 | ||||
-rw-r--r-- | drivers/mtd/spi-nor/cadence-quadspi.c | 2 | ||||
-rw-r--r-- | drivers/mtd/spi-nor/spi-nor.c | 6 | ||||
-rw-r--r-- | include/linux/mtd/nand.h | 7 |
6 files changed, 18 insertions, 10 deletions
diff --git a/drivers/mtd/devices/Kconfig b/drivers/mtd/devices/Kconfig index e514d57a0419..aa983422aa97 100644 --- a/drivers/mtd/devices/Kconfig +++ b/drivers/mtd/devices/Kconfig | |||
@@ -207,7 +207,7 @@ comment "Disk-On-Chip Device Drivers" | |||
207 | config MTD_DOCG3 | 207 | config MTD_DOCG3 |
208 | tristate "M-Systems Disk-On-Chip G3" | 208 | tristate "M-Systems Disk-On-Chip G3" |
209 | select BCH | 209 | select BCH |
210 | select BCH_CONST_PARAMS | 210 | select BCH_CONST_PARAMS if !MTD_NAND_BCH |
211 | select BITREVERSE | 211 | select BITREVERSE |
212 | help | 212 | help |
213 | This provides an MTD device driver for the M-Systems DiskOnChip | 213 | This provides an MTD device driver for the M-Systems DiskOnChip |
diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c index 784c6e1a0391..fd5fe12d7461 100644 --- a/drivers/mtd/maps/sa1100-flash.c +++ b/drivers/mtd/maps/sa1100-flash.c | |||
@@ -221,7 +221,14 @@ static struct sa_info *sa1100_setup_mtd(struct platform_device *pdev, | |||
221 | info->mtd = info->subdev[0].mtd; | 221 | info->mtd = info->subdev[0].mtd; |
222 | ret = 0; | 222 | ret = 0; |
223 | } else if (info->num_subdev > 1) { | 223 | } else if (info->num_subdev > 1) { |
224 | struct mtd_info *cdev[nr]; | 224 | struct mtd_info **cdev; |
225 | |||
226 | cdev = kmalloc_array(nr, sizeof(*cdev), GFP_KERNEL); | ||
227 | if (!cdev) { | ||
228 | ret = -ENOMEM; | ||
229 | goto err; | ||
230 | } | ||
231 | |||
225 | /* | 232 | /* |
226 | * We detected multiple devices. Concatenate them together. | 233 | * We detected multiple devices. Concatenate them together. |
227 | */ | 234 | */ |
@@ -230,6 +237,7 @@ static struct sa_info *sa1100_setup_mtd(struct platform_device *pdev, | |||
230 | 237 | ||
231 | info->mtd = mtd_concat_create(cdev, info->num_subdev, | 238 | info->mtd = mtd_concat_create(cdev, info->num_subdev, |
232 | plat->name); | 239 | plat->name); |
240 | kfree(cdev); | ||
233 | if (info->mtd == NULL) { | 241 | if (info->mtd == NULL) { |
234 | ret = -ENXIO; | 242 | ret = -ENXIO; |
235 | goto err; | 243 | goto err; |
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c index 05bd0779fe9b..71050a0b31df 100644 --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c | |||
@@ -590,7 +590,6 @@ retry: | |||
590 | 590 | ||
591 | /** | 591 | /** |
592 | * panic_nand_wait - [GENERIC] wait until the command is done | 592 | * panic_nand_wait - [GENERIC] wait until the command is done |
593 | * @mtd: MTD device structure | ||
594 | * @chip: NAND chip structure | 593 | * @chip: NAND chip structure |
595 | * @timeo: timeout | 594 | * @timeo: timeout |
596 | * | 595 | * |
diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c index e24db817154e..d846428ef038 100644 --- a/drivers/mtd/spi-nor/cadence-quadspi.c +++ b/drivers/mtd/spi-nor/cadence-quadspi.c | |||
@@ -996,7 +996,7 @@ static int cqspi_direct_read_execute(struct spi_nor *nor, u_char *buf, | |||
996 | err_unmap: | 996 | err_unmap: |
997 | dma_unmap_single(nor->dev, dma_dst, len, DMA_FROM_DEVICE); | 997 | dma_unmap_single(nor->dev, dma_dst, len, DMA_FROM_DEVICE); |
998 | 998 | ||
999 | return 0; | 999 | return ret; |
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | static ssize_t cqspi_read(struct spi_nor *nor, loff_t from, | 1002 | static ssize_t cqspi_read(struct spi_nor *nor, loff_t from, |
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index 9407ca5f9443..3e54e31889c7 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c | |||
@@ -3250,12 +3250,14 @@ static int spi_nor_init_params(struct spi_nor *nor, | |||
3250 | memcpy(&sfdp_params, params, sizeof(sfdp_params)); | 3250 | memcpy(&sfdp_params, params, sizeof(sfdp_params)); |
3251 | memcpy(&prev_map, &nor->erase_map, sizeof(prev_map)); | 3251 | memcpy(&prev_map, &nor->erase_map, sizeof(prev_map)); |
3252 | 3252 | ||
3253 | if (spi_nor_parse_sfdp(nor, &sfdp_params)) | 3253 | if (spi_nor_parse_sfdp(nor, &sfdp_params)) { |
3254 | nor->addr_width = 0; | ||
3254 | /* restore previous erase map */ | 3255 | /* restore previous erase map */ |
3255 | memcpy(&nor->erase_map, &prev_map, | 3256 | memcpy(&nor->erase_map, &prev_map, |
3256 | sizeof(nor->erase_map)); | 3257 | sizeof(nor->erase_map)); |
3257 | else | 3258 | } else { |
3258 | memcpy(params, &sfdp_params, sizeof(*params)); | 3259 | memcpy(params, &sfdp_params, sizeof(*params)); |
3260 | } | ||
3259 | } | 3261 | } |
3260 | 3262 | ||
3261 | return 0; | 3263 | return 0; |
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index abe975c87b90..7f53ece2c039 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
@@ -324,9 +324,8 @@ static inline unsigned int nanddev_ntargets(const struct nand_device *nand) | |||
324 | */ | 324 | */ |
325 | static inline unsigned int nanddev_neraseblocks(const struct nand_device *nand) | 325 | static inline unsigned int nanddev_neraseblocks(const struct nand_device *nand) |
326 | { | 326 | { |
327 | return (u64)nand->memorg.luns_per_target * | 327 | return nand->memorg.ntargets * nand->memorg.luns_per_target * |
328 | nand->memorg.eraseblocks_per_lun * | 328 | nand->memorg.eraseblocks_per_lun; |
329 | nand->memorg.pages_per_eraseblock; | ||
330 | } | 329 | } |
331 | 330 | ||
332 | /** | 331 | /** |
@@ -569,7 +568,7 @@ static inline void nanddev_pos_next_eraseblock(struct nand_device *nand, | |||
569 | } | 568 | } |
570 | 569 | ||
571 | /** | 570 | /** |
572 | * nanddev_pos_next_eraseblock() - Move a position to the next page | 571 | * nanddev_pos_next_page() - Move a position to the next page |
573 | * @nand: NAND device | 572 | * @nand: NAND device |
574 | * @pos: the position to update | 573 | * @pos: the position to update |
575 | * | 574 | * |