drivers: spi: Fixing null-pointer dereference in stm32
Fixes #21935 Signed-off-by: David D <a8961713@gmail.com>
This commit is contained in:
parent
40b49e22ea
commit
b96525c82c
1 changed files with 2 additions and 2 deletions
|
@ -96,14 +96,14 @@ static void spi_stm32_shift_m(SPI_TypeDef *spi, struct spi_stm32_data *data)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (SPI_WORD_SIZE_GET(data->ctx.config->operation) == 8) {
|
if (SPI_WORD_SIZE_GET(data->ctx.config->operation) == 8) {
|
||||||
if (spi_context_tx_on(&data->ctx)) {
|
if (spi_context_tx_buf_on(&data->ctx)) {
|
||||||
tx_frame = UNALIGNED_GET((u8_t *)(data->ctx.tx_buf));
|
tx_frame = UNALIGNED_GET((u8_t *)(data->ctx.tx_buf));
|
||||||
}
|
}
|
||||||
LL_SPI_TransmitData8(spi, tx_frame);
|
LL_SPI_TransmitData8(spi, tx_frame);
|
||||||
/* The update is ignored if TX is off. */
|
/* The update is ignored if TX is off. */
|
||||||
spi_context_update_tx(&data->ctx, 1, 1);
|
spi_context_update_tx(&data->ctx, 1, 1);
|
||||||
} else {
|
} else {
|
||||||
if (spi_context_tx_on(&data->ctx)) {
|
if (spi_context_tx_buf_on(&data->ctx)) {
|
||||||
tx_frame = UNALIGNED_GET((u16_t *)(data->ctx.tx_buf));
|
tx_frame = UNALIGNED_GET((u16_t *)(data->ctx.tx_buf));
|
||||||
}
|
}
|
||||||
LL_SPI_TransmitData16(spi, tx_frame);
|
LL_SPI_TransmitData16(spi, tx_frame);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue