]> git.sur5r.net Git - u-boot/commitdiff
cmd: sf: fix map_physmem check
authorLiam Beguin <liambeguin@gmail.com>
Wed, 14 Mar 2018 23:15:11 +0000 (19:15 -0400)
committerTom Rini <trini@konsulko.com>
Thu, 22 Mar 2018 17:25:20 +0000 (13:25 -0400)
Make sure 0x00 is a valid address to read to. If `addr` is 0x00 then
map_physmem() will return 0 which should be a valid address.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
cmd/sf.c

index f971eec781cc88978f181a9a24ec9d37dff6b11d..e7ff9a6462087239ca7a570c1a97f278d737468a 100644 (file)
--- a/cmd/sf.c
+++ b/cmd/sf.c
@@ -287,7 +287,7 @@ static int do_spi_flash_read_write(int argc, char * const argv[])
        }
 
        buf = map_physmem(addr, len, MAP_WRBACK);
-       if (!buf) {
+       if (!buf && addr) {
                puts("Failed to map physical memory\n");
                return 1;
        }