mirror of
https://xff.cz/git/u-boot/
synced 2025-09-29 22:41:17 +02:00
cmd: sf Drop reassignment of new into flash
The new pointer points to flash found and that would assign it to global 'flash' pointer for further flash operations and also keep track of old flash pointer. This would happen if the probe is successful or even failed, but current code assigning new into flash before and after checking the new. So, drop the assignment after new checks so flash always latest new pointer even if probe failed or succeed. Cc: Simon Glass <sjg@chromium.org> Cc: Vignesh R <vigneshr@ti.com> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
This commit is contained in:
3
cmd/sf.c
3
cmd/sf.c
@@ -145,13 +145,10 @@ static int do_spi_flash_probe(int argc, char *const argv[])
|
|||||||
|
|
||||||
new = spi_flash_probe(bus, cs, speed, mode);
|
new = spi_flash_probe(bus, cs, speed, mode);
|
||||||
flash = new;
|
flash = new;
|
||||||
|
|
||||||
if (!new) {
|
if (!new) {
|
||||||
printf("Failed to initialize SPI flash at %u:%u\n", bus, cs);
|
printf("Failed to initialize SPI flash at %u:%u\n", bus, cs);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
flash = new;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user