From: Liam Beguin Date: Wed, 14 Mar 2018 23:15:11 +0000 (-0400) Subject: cmd: sf: fix map_physmem check X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=10f087f73fff024c81439b50423ba69589d5c161;p=u-boot.git cmd: sf: fix map_physmem check 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 Reviewed-by: Stephen Warren --- diff --git a/cmd/sf.c b/cmd/sf.c index f971eec781..e7ff9a6462 100644 --- 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; }