drivers: spi: esp32: Fix NULL buffers condition
Fix condition in which both TX and RX buffers are NULL inside spi_buf_set structures. Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
This commit is contained in:
parent
bb81347dfb
commit
3780f9d817
1 changed files with 7 additions and 7 deletions
|
@ -413,11 +413,7 @@ static int transceive(const struct device *dev,
|
|||
{
|
||||
const struct spi_esp32_config *cfg = dev->config;
|
||||
struct spi_esp32_data *data = dev->data;
|
||||
int ret;
|
||||
|
||||
if (!tx_bufs && !rx_bufs) {
|
||||
return 0;
|
||||
}
|
||||
int ret = 0;
|
||||
|
||||
#ifndef CONFIG_SPI_ESP32_INTERRUPT
|
||||
if (asynchronous) {
|
||||
|
@ -429,13 +425,17 @@ static int transceive(const struct device *dev,
|
|||
|
||||
data->dfs = spi_esp32_get_frame_size(spi_cfg);
|
||||
|
||||
spi_context_buffers_setup(&data->ctx, tx_bufs, rx_bufs, data->dfs);
|
||||
|
||||
if (data->ctx.tx_buf == NULL && data->ctx.rx_buf == NULL) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
ret = spi_esp32_configure(dev, spi_cfg);
|
||||
if (ret) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
spi_context_buffers_setup(&data->ctx, tx_bufs, rx_bufs, data->dfs);
|
||||
|
||||
spi_context_cs_control(&data->ctx, true);
|
||||
|
||||
#ifdef CONFIG_SPI_ESP32_INTERRUPT
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue