Commit ebea7c05 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Mark Brown

spi: fix counting in spi-loopback-test code

These variables are always used uninitialized:

drivers/spi/spi-loopback-test.c: In function 'spi_test_run_iter':
drivers/spi/spi-loopback-test.c:768:17: warning: 'rx_count' may be used uninitialized in this function [-Wmaybe-uninitialized]
drivers/spi/spi-loopback-test.c:762:17: warning: 'tx_count' may be used uninitialized in this function [-Wmaybe-uninitialized]

Adding an explicit initialization seems to be the only
workable solution here, to make the code behave correctly
and build without warning.

Fixes: 84e0c4e5 ("spi: add loopback test driver to allow for spi_master regression tests")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent cabeea98
...@@ -761,6 +761,7 @@ static int spi_test_run_iter(struct spi_device *spi, ...@@ -761,6 +761,7 @@ static int spi_test_run_iter(struct spi_device *spi,
test.iterate_transfer_mask = 1; test.iterate_transfer_mask = 1;
/* count number of transfers with tx/rx_buf != NULL */ /* count number of transfers with tx/rx_buf != NULL */
rx_count = tx_count = 0;
for (i = 0; i < test.transfer_count; i++) { for (i = 0; i < test.transfer_count; i++) {
if (test.transfers[i].tx_buf) if (test.transfers[i].tx_buf)
tx_count++; tx_count++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment