summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/cmd_sf.c5
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;