[PATCH] spi: atmel: Fix test unsigned var < 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



current_remaining_bytes is an unsigned long and cannot be below 0.

Signed-off-by: Axel Lin <axel.lin@xxxxxxxxxx>
---
 drivers/spi/spi-atmel.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index bda961e..3e8c4cc 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -873,13 +873,11 @@ atmel_spi_pump_pio_data(struct atmel_spi *as, struct spi_transfer *xfer)
 	} else {
 		spi_readl(as, RDR);
 	}
-	if (xfer->bits_per_word > 8) {
+
+	if (xfer->bits_per_word > 8)
 		as->current_remaining_bytes -= 2;
-		if (as->current_remaining_bytes < 0)
-			as->current_remaining_bytes = 0;
-	} else {
+	else
 		as->current_remaining_bytes--;
-	}
 }
 
 /* Interrupt
-- 
1.8.3.2



--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux