mirror of
https://github.com/espressif/esp-idf.git
synced 2025-12-15 19:34:03 +00:00
spi: fixed crash when calling spi_bus_free when not initialized
introduced in 49a48644e4
Closes: https://github.com/espressif/esp-idf/issues/8642
This commit is contained in:
@@ -862,6 +862,10 @@ const spi_bus_attr_t* spi_bus_get_attr(spi_host_device_t host_id)
|
||||
|
||||
esp_err_t spi_bus_free(spi_host_device_t host_id)
|
||||
{
|
||||
if (bus_ctx[host_id] == NULL) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
esp_err_t err = ESP_OK;
|
||||
spicommon_bus_context_t* ctx = bus_ctx[host_id];
|
||||
spi_bus_attr_t* bus_attr = &ctx->bus_attr;
|
||||
|
||||
Reference in New Issue
Block a user