[prev in list] [next in list] [prev in thread] [next in thread] 

List:       flashrom
Subject:    Re: [flashrom] [PATCH] CID1130000: Unchecked return value
From:       Stefan Tauner <stefan.tauner () alumni ! tuwien ! ac ! at>
Date:       2014-04-26 18:39:24
Message-ID: 201404261839.s3QIdOE4022624 () mail2 ! student ! tuwien ! ac ! at
[Download RAW message or body]

On Tue, 19 Nov 2013 20:35:57 +0100
Stefan Reinauer <stefan.reinauer@coreboot.org> 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 <stefan.reinauer@coreboot.org>
> 
> 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
flashrom@flashrom.org
http://www.flashrom.org/mailman/listinfo/flashrom
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic