From: Hector Palacios Date: Thu, 29 Apr 2010 22:02:28 +0000 (-0700) Subject: spi: spidev_test gives error upon 1-byte transfer X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=95b1ed2ac7ffe3205afc6f5a20320fbdb984da92;p=linux-beck.git 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. Signed-off-by: Hector Palacios Signed-off-by: Andrew Morton Signed-off-by: Grant Likely --- diff --git a/Documentation/spi/spidev_test.c b/Documentation/spi/spidev_test.c index 10abd3773e49..16feda901469 100644 --- a/Documentation/spi/spidev_test.c +++ b/Documentation/spi/spidev_test.c @@ -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++) {