From 83c7b4d5d68ddca5fea73d89b4a6f93ba92ed32f Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 6 Aug 2016 08:07:30 -0600 Subject: [PATCH] SPI driver: Correct return value in case of a certain error condition --- drivers/pipes/Kconfig | 9 ++++++--- drivers/spi/spi_driver.c | 2 +- drivers/spi/spi_transfer.c | 4 +++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/pipes/Kconfig b/drivers/pipes/Kconfig index 760f9384dd..ace6ca8458 100644 --- a/drivers/pipes/Kconfig +++ b/drivers/pipes/Kconfig @@ -5,20 +5,23 @@ config DEV_PIPE_MAXSIZE int "Maximum pipe/FIFO size" - default 1024 + default 1024 if !DEFAULT_SMALL + default 256 if DEFAULT_SMALL ---help--- Maximum configurable size of a pipe or FIFO at runtime. config DEV_PIPE_SIZE int "Default pipe size" - default 1024 + default 1024 if !DEFAULT_SMALL + default 256 if DEFAULT_SMALL ---help--- Sets the default size of the pipe ringbuffer in bytes. A value of zero disables pipe support. config DEV_FIFO_SIZE int "Default FIFO size" - default 1024 + default 1024 if !DEFAULT_SMALL + default 256 if DEFAULT_SMALL ---help--- Sets the default size of the FIFO ringbuffer in bytes. A value of zero disables FIFO support. diff --git a/drivers/spi/spi_driver.c b/drivers/spi/spi_driver.c index bbbfb46e68..5f14827c03 100644 --- a/drivers/spi/spi_driver.c +++ b/drivers/spi/spi_driver.c @@ -402,7 +402,7 @@ int spi_register(FAR struct spi_dev_s *spi, int bus) /* Return the result of the registration */ - return OK; + return ret; } return -ENOMEM; diff --git a/drivers/spi/spi_transfer.c b/drivers/spi/spi_transfer.c index 74e312e3fe..5746e4c8aa 100644 --- a/drivers/spi/spi_transfer.c +++ b/drivers/spi/spi_transfer.c @@ -99,7 +99,9 @@ int spi_transfer(FAR struct spi_dev_s *spi, FAR struct spi_sequence_s *seq) SPI_SETMODE(spi, seq->mode); SPI_SETBITS(spi, seq->nbits); - /* Select the SPI device in preparation for the transfer */ + /* Select the SPI device in preparation for the transfer. + * REVISIT: This is redundant. + */ SPI_SELECT(spi, seq->dev, true);