Commit a7d0711a2486b7420a938831512d859879e613cb

Authored by Simon Glass
1 parent aefaff8ed8

spi: sf: Print the error code on failure

Rather than just 'ERROR', display the error code, which may be useful, at
least with driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Jagan Teki <jteki@openedev.com>

Showing 1 changed file with 6 additions and 2 deletions Side-by-side Diff

... ... @@ -303,8 +303,12 @@
303 303 else
304 304 ret = spi_flash_write(flash, offset, len, buf);
305 305  
306   - printf("SF: %zu bytes @ %#x %s: %s\n", (size_t)len, (u32)offset,
307   - read ? "Read" : "Written", ret ? "ERROR" : "OK");
  306 + printf("SF: %zu bytes @ %#x %s: ", (size_t)len, (u32)offset,
  307 + read ? "Read" : "Written");
  308 + if (ret)
  309 + printf("ERROR %d\n", ret);
  310 + else
  311 + printf("OK\n");
308 312 }
309 313  
310 314 unmap_physmem(buf, len);