1
0
Fork 0

mtd, spi: Check if flash pointer is used

If flash pointer is used free it, before probing a new
flash and storing it in flash.

Signed-off-by: Heiko Schocher <hs@denx.de>
Tested-by: Jagannadh Teki <jteki@openedev.com>
Reviewed-by: Jagannadh Teki <jteki@openedev.com>
utp
Heiko Schocher 2015-04-27 07:42:07 +02:00 committed by Jagan Teki
parent 2ec1a4059c
commit 8ee81b7f9b
1 changed files with 5 additions and 0 deletions

View File

@ -135,7 +135,12 @@ static int do_spi_flash_probe(int argc, char * const argv[])
flash = dev_get_uclass_priv(new);
#else
if (flash)
spi_flash_free(flash);
new = spi_flash_probe(bus, cs, speed, mode);
flash = new;
if (!new) {
printf("Failed to initialize SPI flash at %u:%u\n", bus, cs);
return 1;