From: Alexandre Belloni Date: Tue, 6 May 2014 15:44:41 +0000 (+0200) Subject: spi: atmel: fix incorrect comparison X-Git-Tag: firefly_0821_release~176^2~3735^2~4^3 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b112f0585edd1c10e4986373d93ab0d95d12da82;p=firefly-linux-kernel-4.4.55.git 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: Alexandre Belloni Acked-by: Nicolas Ferre Signed-off-by: Mark Brown --- diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index 485e6cce94bf..e6fe837d49fb 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -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) { - as->current_remaining_bytes -= 2; - if (as->current_remaining_bytes < 0) + if (as->current_remaining_bytes > 2) + as->current_remaining_bytes -= 2; + else as->current_remaining_bytes = 0; } else { as->current_remaining_bytes--;