Skip to content

Commit

Permalink
spi: spidev_test gives error upon 1-byte transfer
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hector Palacios authored and Grant Likely committed Apr 29, 2010
1 parent dda04c7 commit 95b1ed2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Documentation/spi/spidev_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down

0 comments on commit 95b1ed2

Please sign in to comment.