From 24403e78dd985555bf2e35a04d9c9ed3e41eaa45 Mon Sep 17 00:00:00 2001 From: Segwon Date: Tue, 19 Dec 2017 15:31:25 +0900 Subject: [PATCH] spi: exclude the positive value in the ioctl error check, becasue of the ioctl return length Change-Id: If7d4d517c519f6d41c6bde7a7716edda4cd6a25a Signed-off-by: Segwon --- src/interface/peripheral_interface_spi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/interface/peripheral_interface_spi.c b/src/interface/peripheral_interface_spi.c index 15baf4b..b38436b 100644 --- a/src/interface/peripheral_interface_spi.c +++ b/src/interface/peripheral_interface_spi.c @@ -66,7 +66,7 @@ int peripheral_interface_spi_read(peripheral_spi_h spi, uint8_t *rxbuf, uint32_t xfer.len = length; ret = ioctl(spi->fd, SPI_IOC_MESSAGE(1), &xfer); - CHECK_ERROR(ret != 0); + CHECK_ERROR(ret < 0); return PERIPHERAL_ERROR_NONE; } @@ -81,7 +81,7 @@ int peripheral_interface_spi_write(peripheral_spi_h spi, uint8_t *txbuf, uint32_ xfer.len = length; ret = ioctl(spi->fd, SPI_IOC_MESSAGE(1), &xfer); - CHECK_ERROR(ret != 0); + CHECK_ERROR(ret < 0); return PERIPHERAL_ERROR_NONE; } @@ -99,7 +99,7 @@ int peripheral_interface_spi_transfer(peripheral_spi_h spi, uint8_t *txbuf, uint xfer.len = length; ret = ioctl(spi->fd, SPI_IOC_MESSAGE(1), &xfer); - CHECK_ERROR(ret != 0); + CHECK_ERROR(ret < 0); return PERIPHERAL_ERROR_NONE; } -- 2.34.1