drivers: spi: Add condition to check buffer pointer

Add condition to check context buffer pointer for Renesas
RA SPI and SPI_B driver

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
This commit is contained in:
Khoa Nguyen 2025-04-28 11:18:51 +07:00 committed by Anas Nashif
commit 9413b8d4cd
2 changed files with 10 additions and 0 deletions

View file

@ -313,6 +313,11 @@ static int transceive(const struct device *dev, const struct spi_config *config,
spi_context_cs_control(&data->ctx, true);
if ((!spi_context_tx_buf_on(&data->ctx)) && (!spi_context_rx_buf_on(&data->ctx))) {
/* If current buffer has no data, do nothing */
goto end;
}
#ifdef CONFIG_SPI_B_INTERRUPT
spi_bit_width_t spi_width =
(spi_bit_width_t)(SPI_WORD_SIZE_GET(data->ctx.config->operation) - 1);

View file

@ -355,6 +355,11 @@ static int transceive(const struct device *dev, const struct spi_config *config,
spi_context_cs_control(&data->ctx, true);
if ((!spi_context_tx_buf_on(&data->ctx)) && (!spi_context_rx_buf_on(&data->ctx))) {
/* If current buffer has no data, do nothing */
goto end;
}
#ifdef CONFIG_SPI_INTERRUPT
if (data->ctx.rx_len == 0) {
data->data_len = spi_context_is_slave(&data->ctx)