arm: at91: arm926ejs/u-boot-spl.lds: Add _image_binary_end to SPL lds
[oweals/u-boot.git] / cmd / sf.c
index 286906c3a151c916d549df6938ad73a0273aec94..738ef0e46dc14fde1ae1550b0873a2a818b7abb6 100644 (file)
--- a/cmd/sf.c
+++ b/cmd/sf.c
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Command for accessing SPI flash.
  *
  * Copyright (C) 2008 Atmel Corporation
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -124,8 +123,7 @@ static int do_spi_flash_probe(int argc, char * const argv[])
        /* Remove the old device, otherwise probe will just be a nop */
        ret = spi_find_bus_and_cs(bus, cs, &bus_dev, &new);
        if (!ret) {
-               device_remove(new);
-               device_unbind(new);
+               device_remove(new, DM_REMOVE_NORMAL);
        }
        flash = NULL;
        ret = spi_flash_probe_bus_cs(bus, cs, speed, mode, &new);
@@ -288,7 +286,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;
        }
@@ -415,7 +413,7 @@ static void show_time(struct test_info *test, int stage)
                do_div(speed, test->time_ms[stage] * 1024);
        bps = speed * 8;
 
-       printf("%d %s: %d ticks, %d KiB/s %d.%03d Mbps\n", stage,
+       printf("%d %s: %u ticks, %d KiB/s %d.%03d Mbps\n", stage,
               stage_name[stage], test->time_ms[stage],
               (int)speed, bps / 1000, bps % 1000);
 }