Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1467010 > unrolled thread

[PATCH 3.10 180/180] spi: spi-xilinx: cleanup a check in xilinx_spi_txrx_bufs()

Started byWilly Tarreau <w@1wt.eu>
First post2016-08-21 17:40 +0200
Last post2016-08-21 17:40 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3.10 180/180] spi: spi-xilinx: cleanup a check in xilinx_spi_txrx_bufs() Willy Tarreau <w@1wt.eu> - 2016-08-21 17:40 +0200

#1467010 — [PATCH 3.10 180/180] spi: spi-xilinx: cleanup a check in xilinx_spi_txrx_bufs()

FromWilly Tarreau <w@1wt.eu>
Date2016-08-21 17:40 +0200
Subject[PATCH 3.10 180/180] spi: spi-xilinx: cleanup a check in xilinx_spi_txrx_bufs()
Message-ID<s8D0S-26R-43@gated-at.bofh.it>
From: "dan.carpenter@oracle.com" <dan.carpenter@oracle.com>

commit e33d085d11e54bc9fb07b2555cd104d8e7b3089b upstream.

'!' has higher precedence than comparisons so the original condition
is equivalent to "if (xspi->remaining_bytes == 0)".  This makes the
static checkers complain.

xspi->remaining_bytes is signed and from looking at the code
briefly, I think it might be able to go negative.  I suspect that
going negative may cause a bug, but I don't have the hardware and
can't test.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/spi/spi-xilinx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
index 34d18dc..109a535 100644
--- a/drivers/spi/spi-xilinx.c
+++ b/drivers/spi/spi-xilinx.c
@@ -315,7 +315,7 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
 		}
 
 		/* See if there is more data to send */
-		if (!xspi->remaining_bytes > 0)
+		if (xspi->remaining_bytes <= 0)
 			break;
 	}
 
-- 
2.8.0.rc2.1.gbe9624a

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web