[U-Boot] [PATCH 01/11] spi: sf: Print the error code on failure

Bin Meng bmeng.cn at gmail.com
Mon Jun 8 03:27:40 CEST 2015


On Sun, Jun 7, 2015 at 10:50 PM, Simon Glass <sjg at chromium.org> wrote:
> Rather than just 'ERROR', display the error code, which may be useful, at
> least with driver model.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
>  common/cmd_sf.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/common/cmd_sf.c b/common/cmd_sf.c
> index 342021d..668df69 100644
> --- a/common/cmd_sf.c
> +++ b/common/cmd_sf.c
> @@ -300,8 +300,12 @@ static int do_spi_flash_read_write(int argc, char * const argv[])
>                 else
>                         ret = spi_flash_write(flash, offset, len, buf);
>
> -               printf("SF: %zu bytes @ %#x %s: %s\n", (size_t)len, (u32)offset,
> -                      read ? "Read" : "Written", ret ? "ERROR" : "OK");
> +               printf("SF: %zu bytes @ %#x %s: ", (size_t)len, (u32)offset,
> +                      read ? "Read" : "Written");
> +               if (ret)
> +                       printf("ERROR %d\n", ret);
> +               else
> +                       printf("OK\n");
>         }
>
>         unmap_physmem(buf, len);
> --

Reviewed-by: Bin Meng <bmeng.cn at gmail.com>


More information about the U-Boot mailing list