linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: atmel: Fix test unsigned var < 0
@ 2014-03-22 14:33 Axel Lin
  2014-03-26 16:51 ` Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Axel Lin @ 2014-03-22 14:33 UTC (permalink / raw)
  To: Mark Brown; +Cc: Wenyou Yang, linux-spi-u79uwXL29TY76Z2rM5mHXA

current_remaining_bytes is an unsigned long and cannot be below 0.

Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
---
 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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-03-27  1:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-22 14:33 [PATCH] spi: atmel: Fix test unsigned var < 0 Axel Lin
2014-03-26 16:51 ` Mark Brown
     [not found]   ` <20140326165145.GD14287-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-03-27  0:46     ` Axel Lin
     [not found]       ` <CAFRkauBh+4-NmneTh=io7grG4MpSZ98riybAOOpEff+KiPZUjg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-03-27  1:13         ` Yang, Wenyou
2014-03-27  1:23           ` Axel Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).