Skip to content

Commit fd3a3f9

Browse files
committed
STM: SPI: Initialize Rx in spi_master_write
In case Rx is not initiliased its content might be random from stack. This is causing problem in case of 8 bits read only as the left-side 8 bits of the returned int value may contain this random byte data. This was for instance detected when using SDFileSystem Lib.
1 parent e7361eb commit fd3a3f9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

targets/TARGET_STM/stm_spi_api.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,8 @@ static inline int ssp_busy(spi_t *obj)
344344

345345
int spi_master_write(spi_t *obj, int value)
346346
{
347-
uint16_t size, Rx, ret;
347+
uint16_t size, ret;
348+
int Rx = 0;
348349
struct spi_s *spiobj = SPI_S(obj);
349350
SPI_HandleTypeDef *handle = &(spiobj->handle);
350351

0 commit comments

Comments
 (0)