linux/drivers/mtd
Masahiro Yamada 336d139f87 mtd: rawnand: denali: do not pass zero maxchips to nand_scan()
Commit 49aa76b166 ("mtd: rawnand: do not execute nand_scan_ident()
if maxchips is zero") gave a new meaning for calling nand_scan_ident()
with maxchips=0.

It is a special usage for some drivers such as docg4, but actually
the Denali driver may pass maxchips=0 to nand_scan() when the driver
is enabled but no NAND chip is found on the board for some reasons.

If nand_scan_with_ids() is called with maxchips=0, nand_scan_ident()
is skipped, then nand_set_defaults() is skipped as well.  Thus, the
driver must set chip->controller beforehand.  Otherwise, nand_attach()
causes NULL pointer dereference.

In fact, the Denali controller knows the number of connected chips
before calling nand_scan_ident(); if DEVICE_RESET fails, there is no
chip in that chip select.  Then, denali_reset_banks() sets the maxchips
to the number of detected chips.  If no chip is found, maxchips is zero.

In this case, there is no point for calling nand_scan() because we know
it will fail for sure.  Let's make the probe function fail immediately.

Fixes: 49aa76b166 ("mtd: rawnand: do not execute nand_scan_ident() if maxchips is zero")
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
2018-08-27 20:41:46 +02:00
..
chips NAND core changes: 2018-08-11 12:15:19 +02:00
devices spi: Updates for v4.19 2018-08-14 12:01:08 -07:00
lpddr mtd: lpddr: use mtd_device_register() 2018-07-24 07:50:22 +02:00
maps mtd/maps: fix solutionengine.c printk format warnings 2018-07-24 22:43:10 +02:00
nand mtd: rawnand: denali: do not pass zero maxchips to nand_scan() 2018-08-27 20:41:46 +02:00
parsers mtd: parsers: trx: add of_match_table with the new DT binding 2018-07-07 10:51:00 +02:00
spi-nor JFFS2 changes: 2018-08-14 10:57:44 -07:00
tests treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
ubi ubi: expose the volume CRC check skip flag 2018-08-15 00:25:21 +02:00
afs.c mtd: partitions: make parsers return 'const' partition arrays 2015-12-09 10:21:57 -08:00
ar7part.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
bcm47xxpart.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
bcm63xxpart.c mtd: bcm63xxpart: give width specifier an 'int', not 'size_t' 2016-03-07 13:13:58 -08:00
cmdlinepart.c mtd: cmdlinepart: Update comment for introduction of OFFSET_CONTINUOUS 2018-05-23 10:08:48 +02:00
ftl.c treewide: Use array_size() in vmalloc() 2018-06-12 16:19:22 -07:00
inftlcore.c mtd: nand: Rename nand.h into rawnand.h 2017-08-13 10:11:49 +02:00
inftlmount.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
Kconfig mtd: Make Kconfig formatting consistent 2018-07-19 23:12:06 +02:00
Makefile mtd: Move onenand code base to drivers/mtd/nand/onenand 2018-03-15 15:40:37 +01:00
mtd_blkdevs.c mtd_blkdevs: handle highmem pages 2018-05-11 15:07:58 -06:00
mtdblock_ro.c
mtdblock.c mtd: Unconditionally update ->fail_addr and ->addr in part_erase() 2018-03-15 18:22:26 +01:00
mtdchar.c mtdchar: fix overflows in adjustment of count 2018-07-18 16:46:38 +02:00
mtdconcat.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
mtdcore.c mtd: Fallback to ->_read/write() when ->_read/write_oob() is missing 2018-07-18 16:44:03 +02:00
mtdcore.h mtd: move code adding (registering) partitions to the parse_mtd_partitions() 2018-05-07 10:10:47 +02:00
mtdoops.c treewide: Use array_size() in vmalloc() 2018-06-12 16:19:22 -07:00
mtdpart.c mtd: partitions: use DT info for parsing partitions with "compatible" prop 2018-07-24 23:04:27 +02:00
mtdsuper.c Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
mtdswap.c treewide: Use array_size() in vmalloc() 2018-06-12 16:19:22 -07:00
nftlcore.c mtd: nand: Rename nand.h into rawnand.h 2017-08-13 10:11:49 +02:00
nftlmount.c mtd: nftl: remove redundant variable nb_erases 2018-07-07 10:55:05 +02:00
ofpart.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
redboot.c mtd: partitions: make parsers return 'const' partition arrays 2015-12-09 10:21:57 -08:00
rfd_ftl.c treewide: Use array_size() in vmalloc() 2018-06-12 16:19:22 -07:00
sm_ftl.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
sm_ftl.h mtd: Stop assuming mtd_erase() is asynchronous 2018-03-15 18:21:07 +01:00
ssfdc.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00