From: Jagan Teki Date: Wed, 13 May 2020 10:58:01 +0000 (+0530) Subject: cmd: sf Drop reassignment of new into flash X-Git-Tag: v2025.01-rc5-pxa1908~2375^2~3 X-Git-Url: http://git.dujemihanovic.xyz/img/static/gitweb.css?a=commitdiff_plain;h=da37b539e62604d090fbc5b52246f8e810f2f9a7;p=u-boot.git 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 Cc: Vignesh R Signed-off-by: Jagan Teki --- diff --git a/cmd/sf.c b/cmd/sf.c index 727837d9cd..d18f6a888c 100644 --- a/cmd/sf.c +++ b/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); flash = new; - if (!new) { printf("Failed to initialize SPI flash at %u:%u\n", bus, cs); return 1; } - - flash = new; #endif return 0;