Skip to contentSkip to conversation

spi: spi-xilinx: cleanup a check in xilinx_spi_txrx_bufs()

PATCH Applied Dan Carpenter 2 participants 2 messages Jun 9, 2013 – Jun 10, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: spi-xilinx: cleanup a check in xilinx_spi_txrx_bufs()

'!' 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.

drivers/spi/spi-xilinx.c +1 -1
index 0b8398c..fb56fcf 100644
@@ -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;
 	}
 
maintainer Applied
#1 lore raw
Quoted 3 lines · Dan Carpenter

'!' 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.