fix(i2c): release platform mutex on intr/pm_lock delete failure

ESP_RETURN_ON_ERROR inside the s_i2c_platform.mutex critical section
returns without releasing the mutex, permanently blocking all I2C
bus operations. Replace with ESP_GOTO_ON_ERROR that jumps to a
cleanup label releasing the mutex before return.
This commit is contained in:
morris
2026-07-29 11:40:42 +08:00
parent 9f2a14562b
commit 1428638fd6
3 changed files with 27 additions and 14 deletions
+5
View File
@@ -212,6 +212,11 @@ static esp_err_t i2c_slave_device_destroy(i2c_slave_dev_handle_t i2c_slave)
i2c_ll_disable_intr_mask(i2c_slave->base->hal.dev, I2C_LL_SLAVE_EVENT_INTR);
i2c_common_deinit_pins(i2c_slave->base);
ret = i2c_release_bus_handle(i2c_slave->base);
if (ret != ESP_OK) {
// Non-OK here means interrupt teardown did not complete, so the ISR
// may still reference i2c_slave and its wrapper-owned resources.
return ret;
}
}
if (i2c_slave->rx_ring_buf) {
vRingbufferDeleteWithCaps(i2c_slave->rx_ring_buf);