From 447ae871fffc9d90371c53d833552156523a78b8 Mon Sep 17 00:00:00 2001 From: safocl Date: Mon, 23 Dec 2024 12:34:59 +0400 Subject: [PATCH] fix(components): Compiler reports some warnings esp-idf/components/driver/twai/twai.c warning: unused variable 'res' [-Wunused-variable] XXX | bool res = twai_hal_init(&p_twai_obj->hal, &hal_config); | ^~~ esp-idf/components/fatfs/diskio/diskio_rawflash.c warning: unused variable 'part' [-Wunused-variable] XX | const esp_partition_t* part = s_ff_raw_handles[pdrv]; | ^~~~ esp-idf/components/fatfs/vfs/vfs_fat_sdmmc.c warning: unused variable 'found' [-Wunused-variable] XXX | bool found = s_get_context_id_by_card(card, &id); | ^~~~~ --- components/driver/twai/twai.c | 9 +++++++-- components/fatfs/diskio/diskio_rawflash.c | 10 +++++++--- components/fatfs/vfs/vfs_fat_sdmmc.c | 8 ++++++-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/components/driver/twai/twai.c b/components/driver/twai/twai.c index b2d64cc4330..2a5b2214c12 100644 --- a/components/driver/twai/twai.c +++ b/components/driver/twai/twai.c @@ -547,8 +547,13 @@ esp_err_t twai_driver_install_v2(const twai_general_config_t *g_config, const tw .clock_source_hz = clock_source_hz, .controller_id = controller_id, }; - bool res = twai_hal_init(&p_twai_obj->hal, &hal_config); - assert(res); + + { + bool res = twai_hal_init(&p_twai_obj->hal, &hal_config); + (void)res; + assert(res); + } + twai_hal_configure(&p_twai_obj->hal, t_config, f_config, DRIVER_DEFAULT_INTERRUPTS, g_config->clkout_divider); //Assign GPIO and Interrupts diff --git a/components/fatfs/diskio/diskio_rawflash.c b/components/fatfs/diskio/diskio_rawflash.c index 313aacec4b8..4b7c50b7459 100644 --- a/components/fatfs/diskio/diskio_rawflash.c +++ b/components/fatfs/diskio/diskio_rawflash.c @@ -91,9 +91,13 @@ DRESULT ff_raw_write (BYTE pdrv, const BYTE *buff, DWORD sector, UINT count) DRESULT ff_raw_ioctl (BYTE pdrv, BYTE cmd, void *buff) { - const esp_partition_t* part = s_ff_raw_handles[pdrv]; - ESP_LOGV(TAG, "ff_raw_ioctl: cmd=%in", cmd); - assert(part); + { + const esp_partition_t* part = s_ff_raw_handles[pdrv]; + ESP_LOGV(TAG, "ff_raw_ioctl: cmd=%in", cmd); + (void)part; + assert(part); + } + switch (cmd) { case CTRL_SYNC: return RES_OK; diff --git a/components/fatfs/vfs/vfs_fat_sdmmc.c b/components/fatfs/vfs/vfs_fat_sdmmc.c index 335385b1ecf..8c28ec88134 100644 --- a/components/fatfs/vfs/vfs_fat_sdmmc.c +++ b/components/fatfs/vfs/vfs_fat_sdmmc.c @@ -500,8 +500,12 @@ esp_err_t esp_vfs_fat_sdcard_format_cfg(const char *base_path, sdmmc_card_t *car //format uint32_t id = FF_VOLUMES; - bool found = s_get_context_id_by_card(card, &id); - assert(found); + + { + bool found = s_get_context_id_by_card(card, &id); + (void)found; + assert(found); + } if (cfg) { s_ctx[id]->mount_config = *cfg;