forked from espressif/esp-idf
Merge branch 'refactor/fix_code_coverity_issue' into 'master'
fatfs: fix deadcode issue Closes IDF-6913 See merge request espressif/esp-idf!22413
This commit is contained in:
@@ -296,10 +296,6 @@ cleanup:
|
|||||||
}
|
}
|
||||||
free(card);
|
free(card);
|
||||||
free(dup_path);
|
free(dup_path);
|
||||||
if (ctx) {
|
|
||||||
free(ctx);
|
|
||||||
s_ctx[ctx_id] = NULL;
|
|
||||||
}
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -396,12 +392,7 @@ cleanup:
|
|||||||
}
|
}
|
||||||
free(card);
|
free(card);
|
||||||
free(dup_path);
|
free(dup_path);
|
||||||
if (ctx) {
|
|
||||||
free(ctx);
|
|
||||||
s_ctx[ctx_id] = NULL;
|
|
||||||
}
|
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void call_host_deinit(const sdmmc_host_t *host_config)
|
static void call_host_deinit(const sdmmc_host_t *host_config)
|
||||||
|
@@ -157,7 +157,7 @@ esp_err_t esp_vfs_fat_spiflash_mount_rw_wl(const char* base_path,
|
|||||||
memcpy(&ctx->mount_config, mount_config, sizeof(esp_vfs_fat_mount_config_t));
|
memcpy(&ctx->mount_config, mount_config, sizeof(esp_vfs_fat_mount_config_t));
|
||||||
ctx_id = s_get_unused_context_id();
|
ctx_id = s_get_unused_context_id();
|
||||||
//At this stage, we should always get a free context, otherwise program should return already
|
//At this stage, we should always get a free context, otherwise program should return already
|
||||||
assert (ctx_id != FF_VOLUMES);
|
assert(ctx_id != FF_VOLUMES);
|
||||||
s_ctx[ctx_id] = ctx;
|
s_ctx[ctx_id] = ctx;
|
||||||
|
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
@@ -165,9 +165,6 @@ esp_err_t esp_vfs_fat_spiflash_mount_rw_wl(const char* base_path,
|
|||||||
fail:
|
fail:
|
||||||
esp_vfs_fat_unregister_path(base_path);
|
esp_vfs_fat_unregister_path(base_path);
|
||||||
ff_diskio_unregister(pdrv);
|
ff_diskio_unregister(pdrv);
|
||||||
if (ctx_id != FF_VOLUMES) {
|
|
||||||
s_ctx[ctx_id] = NULL;
|
|
||||||
}
|
|
||||||
free(ctx);
|
free(ctx);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -177,6 +174,11 @@ esp_err_t esp_vfs_fat_spiflash_unmount_rw_wl(const char* base_path, wl_handle_t
|
|||||||
BYTE pdrv = ff_diskio_get_pdrv_wl(wl_handle);
|
BYTE pdrv = ff_diskio_get_pdrv_wl(wl_handle);
|
||||||
ESP_RETURN_ON_FALSE(pdrv != 0xff, ESP_ERR_INVALID_STATE, TAG, "partition isn't registered, call esp_vfs_fat_spiflash_mount_rw_wl first");
|
ESP_RETURN_ON_FALSE(pdrv != 0xff, ESP_ERR_INVALID_STATE, TAG, "partition isn't registered, call esp_vfs_fat_spiflash_mount_rw_wl first");
|
||||||
|
|
||||||
|
uint32_t id = FF_VOLUMES;
|
||||||
|
ESP_RETURN_ON_FALSE(s_get_context_id_by_wl_handle(wl_handle, &id), ESP_ERR_INVALID_STATE, TAG, "partition isn't registered, call esp_vfs_fat_spiflash_mount_rw_wl first");
|
||||||
|
//At this stage, as the wl_handle is valid, we should always get its context id, otherwise program should return already
|
||||||
|
assert(id != FF_VOLUMES);
|
||||||
|
|
||||||
char drv[3] = {(char)('0' + pdrv), ':', 0};
|
char drv[3] = {(char)('0' + pdrv), ':', 0};
|
||||||
f_mount(0, drv, 0);
|
f_mount(0, drv, 0);
|
||||||
ff_diskio_unregister(pdrv);
|
ff_diskio_unregister(pdrv);
|
||||||
@@ -188,8 +190,6 @@ esp_err_t esp_vfs_fat_spiflash_unmount_rw_wl(const char* base_path, wl_handle_t
|
|||||||
err = err_drv;
|
err = err_drv;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t id = FF_VOLUMES;
|
|
||||||
s_get_context_id_by_wl_handle(wl_handle, &id);
|
|
||||||
free(s_ctx[id]);
|
free(s_ctx[id]);
|
||||||
s_ctx[id] = NULL;
|
s_ctx[id] = NULL;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user