summaryrefslogtreecommitdiff
path: root/drivers/spi/spi-atmel.c
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@free-electrons.com>2014-05-06 17:44:41 +0200
committerMark Brown <broonie@linaro.org>2014-05-07 20:50:20 +0100
commitb112f0585edd1c10e4986373d93ab0d95d12da82 (patch)
tree468579ff0f745525be227eef4bebc4b634b3dad1 /drivers/spi/spi-atmel.c
parent0c3b97487d15a452f1fa7bfd9b6f1bd1a31d538d (diff)
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 <alexandre.belloni@free-electrons.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/spi/spi-atmel.c')
-rw-r--r--drivers/spi/spi-atmel.c5
1 files changed, 3 insertions, 2 deletions
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--;