* [patch -next] spi: spi-xilinx: cleanup a check in xilinx_spi_txrx_bufs()
@ 2013-06-09 13:07 Dan Carpenter, Peter Crosthwaite
2013-06-10 9:28 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter, Peter Crosthwaite @ 2013-06-09 13:07 UTC (permalink / raw)
To: Mark Brown
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA, Michal Simek, Rob Herring,
linux-spi-u79uwXL29TY76Z2rM5mHXA, Grant Likely
'!' 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-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
index 0b8398c..fb56fcf 100644
--- a/drivers/spi/spi-xilinx.c
+++ b/drivers/spi/spi-xilinx.c
@@ -301,7 +301,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;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch -next] spi: spi-xilinx: cleanup a check in xilinx_spi_txrx_bufs()
2013-06-09 13:07 [patch -next] spi: spi-xilinx: cleanup a check in xilinx_spi_txrx_bufs() Dan Carpenter, Peter Crosthwaite
@ 2013-06-10 9:28 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2013-06-10 9:28 UTC (permalink / raw)
To: Dan Carpenter, Peter Crosthwaite
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA, Michal Simek, Rob Herring,
linux-spi-u79uwXL29TY76Z2rM5mHXA, Grant Likely
[-- Attachment #1.1: Type: text/plain, Size: 250 bytes --]
On Sun, Jun 09, 2013 at 04:07:28PM +0300, Dan Carpenter wrote:
> '!' has higher precedence than comparisons so the original condition
> is equivalent to "if (xspi->remaining_bytes == 0)". This makes the
> static checkers complain.
Applied, thanks.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 192 bytes --]
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
https://lists.ozlabs.org/listinfo/devicetree-discuss
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-06-10 9:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-09 13:07 [patch -next] spi: spi-xilinx: cleanup a check in xilinx_spi_txrx_bufs() Dan Carpenter, Peter Crosthwaite
2013-06-10 9:28 ` Mark Brown
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).