fatfs: fix deadcode issue

This commit is contained in:
Armando
2023-02-17 16:22:10 +08:00
committed by BOT
parent ad19981af8
commit 0a472225cc
2 changed files with 6 additions and 15 deletions

View File

@@ -296,10 +296,6 @@ cleanup:
}
free(card);
free(dup_path);
if (ctx) {
free(ctx);
s_ctx[ctx_id] = NULL;
}
return err;
}
#endif
@@ -396,12 +392,7 @@ cleanup:
}
free(card);
free(dup_path);
if (ctx) {
free(ctx);
s_ctx[ctx_id] = NULL;
}
return err;
}
static void call_host_deinit(const sdmmc_host_t *host_config)

View File

@@ -165,9 +165,6 @@ esp_err_t esp_vfs_fat_spiflash_mount_rw_wl(const char* base_path,
fail:
esp_vfs_fat_unregister_path(base_path);
ff_diskio_unregister(pdrv);
if (ctx_id != FF_VOLUMES) {
s_ctx[ctx_id] = NULL;
}
free(ctx);
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);
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};
f_mount(0, drv, 0);
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;
}
uint32_t id = FF_VOLUMES;
s_get_context_id_by_wl_handle(wl_handle, &id);
free(s_ctx[id]);
s_ctx[id] = NULL;