u-boot-brain/drivers/mtd/spi
Peng Fan 4fbad92e73 mtd: spi: check return value of spi_setup_slave
Need to check value of spi_setup_slave and spi_setup_slave_fdt.
If their return value 'bus' is NULL, there is no need to pass it
to following spi_flash_probe_tail.

If 'bus' is null, the original function flow is as following:
spi_flash_probe
	|->spi_setup_slave
	|->spi_probe_bus_tail
		|->spi_flash_probe_slave
		|->spi_free_slave
Alougth check the pointer in spi_free_slave is ok, checking the return value
of spi_setup_slave and spi_setup_slave_fdt is better.

Before this fix:
"
=> sf probe 0:2
FSL_QSPI: Not a valid cs !
SF: Failed to set up slave
data abort
pc : [<fff66dcc>]          lr : [<fff7628c>]
reloc pc : [<87814dcc>]    lr : [<8782428c>]
sp : fdf4fcf0  ip : e630396c     fp : fe0d0888
r10: fffa2538  r9 : fdf4feb8     r8 : 02625a00
r7 : 00000002  r6 : fff94ec0     r5 : 00000000  r4 : 9355553c
r3 : 1af0593c  r2 : cb3fe030     r1 : fff94eb8  r0 : e59ff018
Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...
"

After this fix:
"
=> sf probe 0:2
FSL_QSPI: Not a valid cs !
Failed to initialize SPI flash at 0:2
"
No data abort using this patch.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Reviewed-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
2015-04-22 17:06:13 +05:30
..
eeprom_m95xxx.c Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
fsl_espi_spl.c driver: Add support of image load for MMC & SPI in SPL 2014-04-22 17:58:50 -07:00
Kconfig sandbox: Move CONFIG_SPI_FLASH_SANDBOX to Kconfig 2015-04-18 11:11:38 -06:00
Makefile mtd: sf: Zap ramtron driver 2014-12-18 18:17:54 +05:30
sandbox.c dm: spi: Move slave details to child platdata 2015-01-29 17:09:56 -07:00
sf_internal.h sf: Enable byte program support 2014-12-13 15:08:04 -07:00
sf_ops.c sf: Poll both the read status and flag status 2015-04-22 16:49:51 +05:30
sf_params.c sf: sf_params: Add S25FL164K flash identifier info 2014-12-18 18:48:30 +05:30
sf_probe.c mtd: spi: check return value of spi_setup_slave 2015-04-22 17:06:13 +05:30
sf-uclass.c dm: sf: Add driver model read/write/erase methods 2015-04-18 11:11:14 -06:00
sf.c sf: Add CONFIG_SF_DUAL_FLASH 2014-01-12 21:40:22 +05:30
spi_spl_load.c sf: Tidy up public and private header files 2014-10-22 10:36:50 -06:00