You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2022/10/25 07:13:13 UTC
[mynewt-core] branch master updated: stm32/spi: Fix uninitialized return value
This is an automated email from the ASF dual-hosted git repository.
jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
The following commit(s) were added to refs/heads/master by this push:
new 28d9caf6b stm32/spi: Fix uninitialized return value
28d9caf6b is described below
commit 28d9caf6b05751de48dab77e3ebb6e324fd03ecb
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Sat Oct 22 14:16:59 2022 +0200
stm32/spi: Fix uninitialized return value
if STM32_HAL_SPI_RESOLVE() fails code jumps to err:
where retval is uninitialized.
uint16_t hal_spi_tx_val(int spi_num, uint16_t val)
{
...
uint16_t retval;
...
STM32_HAL_SPI_RESOLVE(spi_num, spi);
...
err:
return retval;
}
---
hw/mcu/stm/stm32_common/src/hal_spi.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/hw/mcu/stm/stm32_common/src/hal_spi.c b/hw/mcu/stm/stm32_common/src/hal_spi.c
index 8c5fd6d0d..95999a1f5 100644
--- a/hw/mcu/stm/stm32_common/src/hal_spi.c
+++ b/hw/mcu/stm/stm32_common/src/hal_spi.c
@@ -912,13 +912,12 @@ uint16_t hal_spi_tx_val(int spi_num, uint16_t val)
{
int rc;
struct stm32_hal_spi *spi;
- uint16_t retval;
+ uint16_t retval = 0xFFFF;
int len;
int sr;
STM32_HAL_SPI_RESOLVE(spi_num, spi);
if (spi->slave) {
- retval = -1;
goto err;
}
if (spi->handle.Init.DataSize == SPI_DATASIZE_8BIT) {