diff options
author | Heiko Schocher <hs@denx.de> | 2015-04-27 05:42:07 (GMT) |
---|---|---|
committer | Jagan Teki <jteki@openedev.com> | 2015-06-29 19:10:11 (GMT) |
commit | 8ee81b7f9b675cb675119a998b04ca843d24ddcd (patch) | |
tree | 7b262b3a83c9d92354f24abdb87e9f26ee497f08 | |
parent | 2ec1a4059cd0421653b19979a046e9fb7296652f (diff) | |
download | u-boot-fsl-qoriq-8ee81b7f9b675cb675119a998b04ca843d24ddcd.tar.xz |
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>
-rw-r--r-- | common/cmd_sf.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/common/cmd_sf.c b/common/cmd_sf.c index 9bced29..aef8c2a 100644 --- a/common/cmd_sf.c +++ b/common/cmd_sf.c @@ -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; |