1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/soft_spi: fix device validation bug

The code did not take into account that valid bus numbers are
0...(COUNT-1).

This patch corrects this. It also makes use of the newly introduced
SOFT_SPI_NUMOF define.
This commit is contained in:
Joshua DeWeese 2022-12-09 14:30:08 -05:00
parent 022192ecee
commit aba1d9aaf0

View File

@ -40,7 +40,7 @@ static inline bool soft_spi_bus_is_valid(soft_spi_t bus)
{
unsigned int soft_spi_num = (unsigned int) bus;
if (ARRAY_SIZE(soft_spi_config) < soft_spi_num) {
if (SOFT_SPI_NUMOF <= soft_spi_num) {
return false;
}
return true;