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@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;
On Mon, 19 Jan 2015 23:00:35 +0100 Paul Menzel paulepanter@users.sourceforge.net wrote:
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.).
Hi Paul,
thanks for the patch. Coverity does detect that as well. Removal is not the only option though. We could also check if pos is correct afterwards. That would make that assignment vital... I am not sure yet how to proceed and will leave it as is since it does no harm.