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.
pull/3540/head
Laurent MEUNIER 2017-01-06 13:20:55 +01:00
parent e7361ebc44
commit fd3a3f9de8
1 changed files with 2 additions and 1 deletions

View File

@ -344,7 +344,8 @@ static inline int ssp_busy(spi_t *obj)
int spi_master_write(spi_t *obj, int value)
{
uint16_t size, Rx, ret;
uint16_t size, ret;
int Rx = 0;
struct spi_s *spiobj = SPI_S(obj);
SPI_HandleTypeDef *handle = &(spiobj->handle);