Skip to contentSkip to conversation

spi: spidev_test gives error upon 1-byte transfer

PATCH New Hector Palacios 1 participant 1 message Apr 20, 2010 SPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: spidev_test gives error upon 1-byte transfer

The sample application spidev_test.c is using SPI_IOC_MESSAGE ioctl to do an SPI transfer. This ioctl returns the number of bytes successfully transmitted or a negative error code upon erroneous completion. The application however is returning an error if the result of the ioclt if the return value is 1. This makes the application to fail upon 1-byte length transfers.

---
 Documentation/spi/spidev_test.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Documentation/spi/spidev_test.c +1 -1
index c1a5aad..8c9d02e 100644
@@ -58,7 +58,7 @@ static void transfer(int fd)
 	};
 
 	ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr);
-	if (ret == 1)
+	if (ret < 1)
 		pabort("can't send spi message");
 
 	for (ret = 0; ret < ARRAY_SIZE(tx); ret++) {
Signature · 1 line
1.7.0.5