fix(linux): Fix warnings for Linux target when COMPILER_STATIC_ANALYZER=y

This commit is contained in:
Konstantin Kondrashov
2024-06-27 15:19:26 +03:00
parent 97f26e99d1
commit 0bdf675992
3 changed files with 8 additions and 3 deletions

View File

@@ -231,6 +231,7 @@ esp_err_t esp_partition_file_mmap(const uint8_t **part_desc_addr_start)
if (fseek(f_partition_table, 0L, SEEK_END) != 0) { if (fseek(f_partition_table, 0L, SEEK_END) != 0) {
ESP_LOGE(TAG, "Failed to seek in partition table file %s: %s", s_esp_partition_file_mmap_ctrl_act.partition_file_name, strerror(errno)); ESP_LOGE(TAG, "Failed to seek in partition table file %s: %s", s_esp_partition_file_mmap_ctrl_act.partition_file_name, strerror(errno));
ret = ESP_ERR_INVALID_SIZE; ret = ESP_ERR_INVALID_SIZE;
fclose(f_partition_table);
break; break;
} }
@@ -244,6 +245,7 @@ esp_err_t esp_partition_file_mmap(const uint8_t **part_desc_addr_start)
(uint32_t) s_esp_partition_file_mmap_ctrl_act.flash_file_size, (uint32_t) s_esp_partition_file_mmap_ctrl_act.flash_file_size,
(int) (partition_table_file_size + ESP_PARTITION_TABLE_OFFSET)); (int) (partition_table_file_size + ESP_PARTITION_TABLE_OFFSET));
ret = ESP_ERR_INVALID_SIZE; ret = ESP_ERR_INVALID_SIZE;
fclose(f_partition_table);
break; break;
} }
@@ -251,6 +253,7 @@ esp_err_t esp_partition_file_mmap(const uint8_t **part_desc_addr_start)
if (fseek(f_partition_table, 0L, SEEK_SET) != 0) { if (fseek(f_partition_table, 0L, SEEK_SET) != 0) {
ESP_LOGE(TAG, "Failed to seek in partition table file %s: %s", s_esp_partition_file_mmap_ctrl_act.partition_file_name, strerror(errno)); ESP_LOGE(TAG, "Failed to seek in partition table file %s: %s", s_esp_partition_file_mmap_ctrl_act.partition_file_name, strerror(errno));
ret = ESP_ERR_INVALID_SIZE; ret = ESP_ERR_INVALID_SIZE;
fclose(f_partition_table);
break; break;
} }
@@ -667,7 +670,7 @@ static bool esp_partition_hook_erase(const void *dstAddr, size_t *size)
} }
} }
// update statistcs for all sectors until power down cycle // update statistics for all sectors until power down cycle
for (size_t sector_index = first_sector_idx; sector_index < first_sector_idx + sector_count; sector_index++) { for (size_t sector_index = first_sector_idx; sector_index < first_sector_idx + sector_count; sector_index++) {
++s_esp_partition_stat_erase_ops; ++s_esp_partition_stat_erase_ops;
s_esp_partition_stat_sector_erase_count[sector_index]++; s_esp_partition_stat_sector_erase_count[sector_index]++;

View File

@@ -34,6 +34,7 @@
#include <pthread.h> #include <pthread.h>
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include <assert.h>
#include "wait_for_event.h" #include "wait_for_event.h"
@@ -47,7 +48,7 @@ struct event
struct event * event_create() struct event * event_create()
{ {
struct event * ev = malloc( sizeof( struct event ) ); struct event * ev = malloc( sizeof( struct event ) );
assert(ev != NULL);
ev->event_triggered = false; ev->event_triggered = false;
pthread_mutex_init( &ev->mutex, NULL ); pthread_mutex_init( &ev->mutex, NULL );
pthread_cond_init( &ev->cond, NULL ); pthread_cond_init( &ev->cond, NULL );

View File

@@ -34,6 +34,7 @@
#include <pthread.h> #include <pthread.h>
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include <assert.h>
#include "wait_for_event.h" #include "wait_for_event.h"
@@ -47,7 +48,7 @@ struct event
struct event * event_create(void) struct event * event_create(void)
{ {
struct event * ev = malloc( sizeof( struct event ) ); struct event * ev = malloc( sizeof( struct event ) );
assert(ev != NULL);
ev->event_triggered = false; ev->event_triggered = false;
pthread_mutex_init( &ev->mutex, NULL ); pthread_mutex_init( &ev->mutex, NULL );
pthread_cond_init( &ev->cond, NULL ); pthread_cond_init( &ev->cond, NULL );