From d3b252d8ce210e15eed6ca480206471c0b4da115 Mon Sep 17 00:00:00 2001 From: morris Date: Fri, 3 Jul 2026 18:10:15 +0800 Subject: [PATCH] fix(i2c): remove unused but set variables --- components/esp_driver_i2c/CMakeLists.txt | 2 -- components/esp_driver_i2c/i2c_master.c | 9 --------- components/esp_driver_i2c/i2c_private.h | 1 - components/soc/esp32/include/soc/dac_channel.h | 2 -- components/soc/esp32s2/include/soc/dac_channel.h | 2 -- 5 files changed, 16 deletions(-) diff --git a/components/esp_driver_i2c/CMakeLists.txt b/components/esp_driver_i2c/CMakeLists.txt index 6addeee859d..55df31758ee 100644 --- a/components/esp_driver_i2c/CMakeLists.txt +++ b/components/esp_driver_i2c/CMakeLists.txt @@ -28,5 +28,3 @@ idf_component_register(SRCS ${srcs} PRIV_REQUIRES "${priv_requires}" LDFRAGMENTS "linker.lf" ) -set_source_files_properties("i2c_master.c" - PROPERTIES COMPILE_FLAGS "-Wno-unused-but-set-variable") diff --git a/components/esp_driver_i2c/i2c_master.c b/components/esp_driver_i2c/i2c_master.c index 811fc457f1c..4ec1fa125b8 100644 --- a/components/esp_driver_i2c/i2c_master.c +++ b/components/esp_driver_i2c/i2c_master.c @@ -922,10 +922,6 @@ static esp_err_t i2c_master_bus_destroy(i2c_master_bus_handle_t bus_handle) vQueueDeleteWithCaps(i2c_master->event_queue); i2c_master->event_queue = NULL; } - if (i2c_master->queues_storage) { - free(i2c_master->queues_storage); - i2c_master->queues_storage = NULL; - } free(i2c_master->i2c_async_ops); i2c_master->i2c_async_ops = NULL; for (int i = 0; i < I2C_TRANS_QUEUE_MAX; i++) { @@ -1134,13 +1130,8 @@ esp_err_t i2c_new_master_bus(const i2c_master_bus_config_t *bus_config, i2c_mast i2c_master->trans_finish = true; i2c_master->new_queue = true; i2c_master->queue_size = bus_config->trans_queue_depth; - i2c_master->queues_storage = (uint8_t*)heap_caps_calloc(bus_config->trans_queue_depth * I2C_TRANS_QUEUE_MAX, sizeof(i2c_transaction_t), I2C_MEM_ALLOC_CAPS); - ESP_GOTO_ON_FALSE(i2c_master->queues_storage, ESP_ERR_NO_MEM, err, TAG, "no mem for queue storage"); - i2c_transaction_t **pp_trans_desc = (i2c_transaction_t **)i2c_master->queues_storage; for (int i = 0; i < I2C_TRANS_QUEUE_MAX; i++) { i2c_master->trans_queues[i] = xQueueCreateWithCaps(bus_config->trans_queue_depth, sizeof(i2c_transaction_t), I2C_MEM_ALLOC_CAPS); - - pp_trans_desc += bus_config->trans_queue_depth; // sanity check assert(i2c_master->trans_queues[i]); } diff --git a/components/esp_driver_i2c/i2c_private.h b/components/esp_driver_i2c/i2c_private.h index 298919d53f7..a024f57c57a 100644 --- a/components/esp_driver_i2c/i2c_private.h +++ b/components/esp_driver_i2c/i2c_private.h @@ -140,7 +140,6 @@ struct i2c_master_bus_t { size_t queue_size; // I2C transaction queue size. size_t num_trans_inflight; // Indicates the number of transactions that are undergoing but not recycled to ready_queue size_t num_trans_inqueue; // Indicates the number of transaction in queue transaction. - void* queues_storage; // storage of transaction queues bool sent_all; // true if the queue transaction is sent bool in_progress; // true if current transaction is in progress bool trans_finish; // true if current command has been sent out. diff --git a/components/soc/esp32/include/soc/dac_channel.h b/components/soc/esp32/include/soc/dac_channel.h index 0ae12367604..52c8d6d5410 100644 --- a/components/soc/esp32/include/soc/dac_channel.h +++ b/components/soc/esp32/include/soc/dac_channel.h @@ -8,8 +8,6 @@ #define DAC_GPIO25_CHANNEL DAC_CHAN_0 #define DAC_CHAN0_GPIO_NUM 25 -#define DAC_CHANNEL_1_GPIO_NUM DAC_CHAN0_GPIO_NUM //`DAC_CHANNEL_1_GPIO_NUM` is defined for DAC legacy driver, indicating the first DAC channel. #define DAC_GPIO26_CHANNEL DAC_CHAN_1 #define DAC_CHAN1_GPIO_NUM 26 -#define DAC_CHANNEL_2_GPIO_NUM DAC_CHAN1_GPIO_NUM //`DAC_CHANNEL_2_GPIO_NUM` is defined for DAC legacy driver, indicating the second DAC channel. diff --git a/components/soc/esp32s2/include/soc/dac_channel.h b/components/soc/esp32s2/include/soc/dac_channel.h index 8b6a1b381fc..2ad6fd360eb 100644 --- a/components/soc/esp32s2/include/soc/dac_channel.h +++ b/components/soc/esp32s2/include/soc/dac_channel.h @@ -8,8 +8,6 @@ #define DAC_GPIO17_CHANNEL DAC_CHAN_0 #define DAC_CHAN0_GPIO_NUM 17 -#define DAC_CHANNEL_1_GPIO_NUM DAC_CHAN0_GPIO_NUM //`DAC_CHANNEL_1_GPIO_NUM` is defined for DAC legacy driver, indicating the first DAC channel. #define DAC_GPIO18_CHANNEL DAC_CHAN_1 #define DAC_CHAN1_GPIO_NUM 18 -#define DAC_CHANNEL_2_GPIO_NUM DAC_CHAN1_GPIO_NUM //`DAC_CHANNEL_2_GPIO_NUM` is defined for DAC legacy driver, indicating the second DAC channel.