From b845c66748fe0046203000fbca98875741bb2a0c Mon Sep 17 00:00:00 2001 From: morris Date: Tue, 30 May 2023 10:43:53 +0800 Subject: [PATCH] spi_master: fix the assertion on a NULL desired_dev Closes https://github.com/espressif/esp-idf/issues/11536 --- components/driver/spi/gpspi/spi_master.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/driver/spi/gpspi/spi_master.c b/components/driver/spi/gpspi/spi_master.c index 8aa328b1acae..434056ddfe46 100644 --- a/components/driver/spi/gpspi/spi_master.c +++ b/components/driver/spi/gpspi/spi_master.c @@ -725,10 +725,11 @@ static void SPI_MASTER_ISR_ATTR spi_intr(void *arg) // We stay in the ISR to deal with those transactions of desired device, otherwise nothing will be done, check whether we need to resume some other tasks, or just quit the ISR resume_task = spi_bus_lock_bg_check_dev_acq(lock, &desired_dev); } - // sanity check - assert(desired_dev); if (!resume_task) { + // sanity check + assert(desired_dev); + bool dev_has_req = spi_bus_lock_bg_check_dev_req(desired_dev); if (dev_has_req) { device_to_send = host->device[spi_bus_lock_get_dev_id(desired_dev)];