Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <hector.palacios@digi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

authored by

Hector Palacios and committed by
Grant Likely
95b1ed2a dda04c7b

+1 -1
+1 -1
Documentation/spi/spidev_test.c
··· 58 58 }; 59 59 60 60 ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr); 61 - if (ret == 1) 61 + if (ret < 1) 62 62 pabort("can't send spi message"); 63 63 64 64 for (ret = 0; ret < ARRAY_SIZE(tx); ret++) {