Add check of return value in drivers affected by last change: Report the error on a failure to set the bit order.

This commit is contained in:
Gregory Nutt 2016-08-08 08:40:37 -06:00
parent 7d4cb73bd6
commit 21859af6d9
2 changed files with 27 additions and 3 deletions

View File

@ -272,6 +272,8 @@ static inline int __test_bit(int nr, const volatile uint8_t * addr)
static void memlcd_select(FAR struct spi_dev_s *spi)
{
int ret;
/* Select memlcd (locking the SPI bus in case there are multiple
* devices competing for the SPI bus
*/
@ -285,7 +287,13 @@ static void memlcd_select(FAR struct spi_dev_s *spi)
SPI_SETMODE(spi, MEMLCD_SPI_MODE);
SPI_SETBITS(spi, MEMLCD_SPI_BITS);
(void)SPI_HWFEATURES(spi, HWFEAT_LSBFIRST);
ret = SPI_HWFEATURES(spi, HWFEAT_LSBFIRST);
if (ret < 0)
{
lcderr("ERROR: SPI_HWFEATURES failed to set bit order: %d\n", ret);
}
#ifdef CONFIG_MEMLCD_SPI_FREQUENCY
(void)SPI_SETFREQUENCY(spi, CONFIG_MEMLCD_SPI_FREQUENCY);
#else

View File

@ -149,11 +149,19 @@ static const uint8_t pn532ack[] =
static void pn532_lock(FAR struct spi_dev_s *spi)
{
int ret;
(void)SPI_LOCK(spi, true);
SPI_SETMODE(spi, SPIDEV_MODE0);
SPI_SETBITS(spi, 8);
(void)SPI_HWFEATURES(spi, HWFEAT_LSBFIRST);
ret = SPI_HWFEATURES(spi, HWFEAT_LSBFIRST);
if (ret < 0)
{
pn532err("ERROR: SPI_HWFEATURES failed to set bit order: %d\n", ret);
}
(void)SPI_SETFREQUENCY(spi, CONFIG_PN532_SPI_FREQ);
}
@ -164,11 +172,19 @@ static void pn532_unlock(FAR struct spi_dev_s *spi)
static inline void pn532_configspi(FAR struct spi_dev_s *spi)
{
int ret;
/* Configure SPI for the PN532 module. */
SPI_SETMODE(spi, SPIDEV_MODE0);
SPI_SETBITS(spi, 8);
(void)SPI_HWFEATURES(spi, HWFEAT_LSBFIRST);
ret = SPI_HWFEATURES(spi, HWFEAT_LSBFIRST);
if (ret < 0)
{
pn532err("ERROR: SPI_HWFEATURES failed to set bit order: %d\n", ret);
}
(void)SPI_SETFREQUENCY(spi, CONFIG_PN532_SPI_FREQ);
}