On Tue, 19 Nov 2013 20:35:57 +0100
Stefan Reinauer <[email protected]> wrote:

> CID1130000: Unchecked return value
> 
> If the function returns an error value, the error value may be mistaken for a
> normal value.
> In default_spi_write_aai: Value returned from a function is not checked for
> errors before being used
> 
> Signed-off-by: Stefan Reinauer <[email protected]>
> 
> Index: spi25.c
> ===================================================================
> --- spi25.c   (revision 1763)
> +++ spi25.c   (working copy)
> @@ -1146,8 +1146,10 @@
>       while (pos < start + len - 1) {
>               cmd[1] = buf[pos++ - start];
>               cmd[2] = buf[pos++ - start];
> -             spi_send_command(flash, JEDEC_AAI_WORD_PROGRAM_CONT_OUTSIZE, 0,
> -                              cmd, NULL);
> +             result = spi_send_command(flash, 
> JEDEC_AAI_WORD_PROGRAM_CONT_OUTSIZE,
> +                              0, cmd, NULL);
> +             if (result != 0)
> +                     msg_cerr("%s failed.\n", __func__);
>               while (spi_read_status_register(flash) & SPI_SR_WIP)
>                       programmer_delay(10);
>       }

I have extended this minimalistic version in r1779. It does provide
more information to the user, bails out on errors and most importantly
it does always try to exit AAI mode before leaving the function.

-- 
Kind regards/Mit freundlichen Grüßen, Stefan Tauner

_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to