[HAL][SPI] Fix driver to don't update state in case of error (HAL_SPI_STATE_READY will be set only in case of HAL_TIMEOUT)
diff --git a/Src/stm32l1xx_hal_spi.c b/Src/stm32l1xx_hal_spi.c index b64c489..2b032c8 100644 --- a/Src/stm32l1xx_hal_spi.c +++ b/Src/stm32l1xx_hal_spi.c
@@ -1360,7 +1360,15 @@ __HAL_SPI_CLEAR_OVRFLAG(hspi); } - + if (hspi->ErrorCode != HAL_SPI_ERROR_NONE) + { + errorcode = HAL_ERROR; + } + else + { + hspi->State = HAL_SPI_STATE_READY; + } + error : __HAL_UNLOCK(hspi); return errorcode;