[flashrom] [PATCH] CID1130000: Unchecked return value

Stefan Reinauer stefan.reinauer at coreboot.org
Tue Nov 19 20:35:57 CET 2013


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 at 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);
 	}




More information about the flashrom mailing list