[flashrom] [PATCH] spi25.c: Remove assignment to variable `pos`

Paul Menzel paulepanter at users.sourceforge.net
Mon Jan 19 23:00:35 CET 2015


Date: Mon, 19 Jan 2015 22:51:31 +0100

Address the warning below found by Clang’s static analyzer scan-build
3.6 and remove that assignment.

	spi25.c:1163:3: warning: Value stored to 'pos' is never read
			pos += pos % 2;
			^      ~~~~~~~
	1 warning generated.

This was introduced in revision 1211 (Switch all flash chips to partial
write.).

Signed-off-by: Paul Menzel <paulepanter at users.sourceforge.net>
---
 spi25.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/spi25.c b/spi25.c
index 673bdf5..6c9d0e9 100644
--- a/spi25.c
+++ b/spi25.c
@@ -1157,11 +1157,9 @@ int default_spi_write_aai(struct flashctx *flash, const uint8_t *buf, unsigned i
 	}
 
 	/* Write remaining byte (if any). */
-	if (pos < start + len) {
+	if (pos < start + len)
 		if (spi_chip_write_1(flash, buf + pos - start, pos, pos % 2))
 			return SPI_GENERIC_ERROR;
-		pos += pos % 2;
-	}
 
 	return 0;
 
-- 
2.1.4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <http://www.flashrom.org/pipermail/flashrom/attachments/20150119/8121a137/attachment.asc>


More information about the flashrom mailing list