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:
parent
022192ecee
commit
aba1d9aaf0
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user