Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b112f058 authored by Alexandre Belloni's avatar Alexandre Belloni Committed by Mark Brown
Browse files

spi: atmel: fix incorrect comparison



Found using smatch:
drivers/spi/spi-atmel.c:878 atmel_spi_pump_pio_data() warn: unsigned
'as->current_remaining_bytes' is never less than zero.

Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 0c3b9748
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -874,8 +874,9 @@ atmel_spi_pump_pio_data(struct atmel_spi *as, struct spi_transfer *xfer)
		spi_readl(as, RDR);
	}
	if (xfer->bits_per_word > 8) {
		if (as->current_remaining_bytes > 2)
			as->current_remaining_bytes -= 2;
		if (as->current_remaining_bytes < 0)
		else
			as->current_remaining_bytes = 0;
	} else {
		as->current_remaining_bytes--;