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

drivers/soft_spi: fix over-allocation of locks

The intent was to allocate one lock per device, but that was not the
case in practice. This patch fixes this.
This commit is contained in:
Joshua DeWeese 2022-12-09 14:28:02 -05:00
parent d786883859
commit 022192ecee
2 changed files with 6 additions and 1 deletions

View File

@ -48,6 +48,11 @@ static soft_spi_conf_t soft_spi_config[] = {
SOFT_SPI_PARAMS,
};
/**
* @brief Number of software SPI buses
*/
#define SOFT_SPI_NUMOF ARRAY_SIZE(soft_spi_config)
#ifdef __cplusplus
}
#endif

View File

@ -34,7 +34,7 @@
/**
* @brief Allocate one lock per SPI device
*/
static mutex_t locks[sizeof soft_spi_config];
static mutex_t locks[SOFT_SPI_NUMOF];
static inline bool soft_spi_bus_is_valid(soft_spi_t bus)
{