From a51e102a41c49e5522ab2fc1ecfdc1a5b0726d34 Mon Sep 17 00:00:00 2001 From: Dong Heng Date: Thu, 23 Mar 2023 14:20:22 +0800 Subject: [PATCH] xtensa/esp32: Make asprintf and lib_free corresponding --- arch/xtensa/src/esp32/esp32_wifi_adapter.c | 22 +++++++++---------- .../xtensa/src/esp32s3/esp32s3_wifi_adapter.c | 22 +++++++++---------- drivers/net/telnet.c | 2 +- fs/inode/fs_inodesearch.c | 2 +- fs/inode/inode.h | 3 ++- fs/unionfs/fs_unionfs.c | 4 ++-- fs/vfs/fs_dir.c | 2 +- fs/vfs/fs_rename.c | 4 ++-- 8 files changed, 31 insertions(+), 30 deletions(-) diff --git a/arch/xtensa/src/esp32/esp32_wifi_adapter.c b/arch/xtensa/src/esp32/esp32_wifi_adapter.c index 3541e2c1d1..f632adbe86 100644 --- a/arch/xtensa/src/esp32/esp32_wifi_adapter.c +++ b/arch/xtensa/src/esp32/esp32_wifi_adapter.c @@ -3076,7 +3076,7 @@ static void esp_nvs_close(uint32_t handle) #ifdef CONFIG_ESP32_WIFI_SAVE_PARAM struct nvs_adpt *nvs_adpt = (struct nvs_adpt *)handle; - kmm_free(nvs_adpt->index_name); + lib_free(nvs_adpt->index_name); kmm_free(nvs_adpt); #else DEBUGPANIC(); @@ -3138,7 +3138,7 @@ static int32_t esp_nvs_set_blob(uint32_t handle, if (ret != -ENOENT) { wlerr("Failed to unlink %s error=%d\n", dir, ret); - kmm_free(dir); + lib_free(dir); return -1; } } @@ -3147,7 +3147,7 @@ static int32_t esp_nvs_set_blob(uint32_t handle, if (ret < 0) { wlerr("Failed to set open %s\n", dir); - kmm_free(dir); + lib_free(dir); return -1; } @@ -3155,12 +3155,12 @@ static int32_t esp_nvs_set_blob(uint32_t handle, if (ret < 0) { wlerr("Failed to write to %s\n", dir); - kmm_free(dir); + lib_free(dir); file_close(&file); return -1; } - kmm_free(dir); + lib_free(dir); file_close(&file); return 0; @@ -3213,11 +3213,11 @@ static int32_t esp_nvs_get_blob(uint32_t handle, if (ret == -ENOENT) { wlinfo("No file %s\n", dir); - kmm_free(dir); + lib_free(dir); return ESP_ERR_NVS_NOT_FOUND; } wlerr("Failed to get open %s\n", dir); - kmm_free(dir); + lib_free(dir); return -1; } @@ -3225,7 +3225,7 @@ static int32_t esp_nvs_get_blob(uint32_t handle, if (ret <= 0) { wlerr("Failed to write to %s\n", dir); - kmm_free(dir); + lib_free(dir); file_close(&file); return -1; } @@ -3234,7 +3234,7 @@ static int32_t esp_nvs_get_blob(uint32_t handle, *length = ret; } - kmm_free(dir); + lib_free(dir); file_close(&file); return 0; @@ -3279,11 +3279,11 @@ static int32_t esp_nvs_erase_key(uint32_t handle, const char *key) if (ret < 0) { wlerr("Failed to delete NVS file %s\n", dir); - kmm_free(dir); + lib_free(dir); return -1; } - kmm_free(dir); + lib_free(dir); return 0; #else diff --git a/arch/xtensa/src/esp32s3/esp32s3_wifi_adapter.c b/arch/xtensa/src/esp32s3/esp32s3_wifi_adapter.c index fb2dc660c4..7b0d286e75 100644 --- a/arch/xtensa/src/esp32s3/esp32s3_wifi_adapter.c +++ b/arch/xtensa/src/esp32s3/esp32s3_wifi_adapter.c @@ -2949,7 +2949,7 @@ static void esp_nvs_close(uint32_t handle) #ifdef CONFIG_ESP32S3_WIFI_SAVE_PARAM struct nvs_adpt *nvs_adpt = (struct nvs_adpt *)handle; - kmm_free(nvs_adpt->index_name); + lib_free(nvs_adpt->index_name); kmm_free(nvs_adpt); #else DEBUGPANIC(); @@ -3011,7 +3011,7 @@ static int32_t esp_nvs_set_blob(uint32_t handle, if (ret != -ENOENT) { wlerr("Failed to unlink %s error=%d\n", dir, ret); - kmm_free(dir); + lib_free(dir); return -1; } } @@ -3020,7 +3020,7 @@ static int32_t esp_nvs_set_blob(uint32_t handle, if (ret < 0) { wlerr("Failed to set open %s\n", dir); - kmm_free(dir); + lib_free(dir); return -1; } @@ -3028,12 +3028,12 @@ static int32_t esp_nvs_set_blob(uint32_t handle, if (ret < 0) { wlerr("Failed to write to %s\n", dir); - kmm_free(dir); + lib_free(dir); file_close(&file); return -1; } - kmm_free(dir); + lib_free(dir); file_close(&file); return 0; @@ -3086,11 +3086,11 @@ static int32_t esp_nvs_get_blob(uint32_t handle, if (ret == -ENOENT) { wlinfo("No file %s\n", dir); - kmm_free(dir); + lib_free(dir); return ESP_ERR_NVS_NOT_FOUND; } wlerr("Failed to get open %s\n", dir); - kmm_free(dir); + lib_free(dir); return -1; } @@ -3098,7 +3098,7 @@ static int32_t esp_nvs_get_blob(uint32_t handle, if (ret <= 0) { wlerr("Failed to write to %s\n", dir); - kmm_free(dir); + lib_free(dir); file_close(&file); return -1; } @@ -3107,7 +3107,7 @@ static int32_t esp_nvs_get_blob(uint32_t handle, *length = ret; } - kmm_free(dir); + lib_free(dir); file_close(&file); return 0; @@ -3152,11 +3152,11 @@ static int32_t esp_nvs_erase_key(uint32_t handle, const char *key) if (ret < 0) { wlerr("Failed to delete NVS file %s\n", dir); - kmm_free(dir); + lib_free(dir); return -1; } - kmm_free(dir); + lib_free(dir); return 0; #else diff --git a/drivers/net/telnet.c b/drivers/net/telnet.c index 63e8ef5ef3..5176ee0457 100644 --- a/drivers/net/telnet.c +++ b/drivers/net/telnet.c @@ -725,7 +725,7 @@ static int telnet_close(FAR struct file *filep) } } - kmm_free(devpath); + lib_free(devpath); } for (i = 0; i < CONFIG_TELNET_MAXLCLIENTS; i++) diff --git a/fs/inode/fs_inodesearch.c b/fs/inode/fs_inodesearch.c index 920d81794c..a46e1602ee 100644 --- a/fs/inode/fs_inodesearch.c +++ b/fs/inode/fs_inodesearch.c @@ -357,7 +357,7 @@ static int _inode_search(FAR struct inode_search_s *desc) "%s/%s", desc->relpath, name); if (buffer != NULL) { - kmm_free(desc->buffer); + lib_free(desc->buffer); desc->buffer = buffer; relpath = buffer; } diff --git a/fs/inode/inode.h b/fs/inode/inode.h index 3161a52a60..050b10975f 100644 --- a/fs/inode/inode.h +++ b/fs/inode/inode.h @@ -35,6 +35,7 @@ #include #include +#include /**************************************************************************** * Pre-processor Definitions @@ -58,7 +59,7 @@ { \ if ((d)->buffer != NULL) \ { \ - kmm_free((d)->buffer); \ + lib_free((d)->buffer); \ (d)->buffer = NULL; \ } \ } \ diff --git a/fs/unionfs/fs_unionfs.c b/fs/unionfs/fs_unionfs.c index 69986a2c97..e4aed41ec1 100644 --- a/fs/unionfs/fs_unionfs.c +++ b/fs/unionfs/fs_unionfs.c @@ -1775,7 +1775,7 @@ static int unionfs_readdir(FAR struct inode *mountpt, /* Free the allocated relpath */ - kmm_free(relpath); + lib_free(relpath); /* Check for a duplicate */ @@ -1862,7 +1862,7 @@ static int unionfs_readdir(FAR struct inode *mountpt, /* Free the allocated relpath */ - kmm_free(relpath); + lib_free(relpath); } } } diff --git a/fs/vfs/fs_dir.c b/fs/vfs/fs_dir.c index 18009db66a..1fa68dbb66 100644 --- a/fs/vfs/fs_dir.c +++ b/fs/vfs/fs_dir.c @@ -449,7 +449,7 @@ static int dir_close(FAR struct file *filep) /* Release our references on the contained 'root' inode */ inode_release(inode); - kmm_free(relpath); + lib_free(relpath); return ret; } diff --git a/fs/vfs/fs_rename.c b/fs/vfs/fs_rename.c index e87518e8e1..add0f109e8 100644 --- a/fs/vfs/fs_rename.c +++ b/fs/vfs/fs_rename.c @@ -244,7 +244,7 @@ errout: RELEASE_SEARCH(&newdesc); if (subdir != NULL) { - kmm_free(subdir); + lib_free(subdir); } return ret; @@ -429,7 +429,7 @@ errout_with_newsearch: RELEASE_SEARCH(&newdesc); if (subdir != NULL) { - kmm_free(subdir); + lib_free(subdir); } return ret;