Commit 9413b8d4 authored by Khoa Nguyen's avatar Khoa Nguyen Committed by Anas Nashif
Browse files

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: default avatarKhoa Nguyen <khoa.nguyen.xh@renesas.com>
parent 7f78eb75
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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);
+5 −0
Original line number Diff line number Diff line
@@ -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)