fatfs: fix deinit not called for SDSPI host

Closes https://github.com/espressif/esp-idf/issues/1362
This commit is contained in:
Ivan Grokhotkov 2017-12-08 12:17:58 +08:00
parent 28e4162dd2
commit ae30d1bc7b

View file

@ -139,7 +139,7 @@ esp_err_t esp_vfs_fat_sdmmc_mount(const char* base_path,
return ESP_OK;
fail:
sdmmc_host_deinit();
host_config->deinit();
free(workbuf);
if (fs) {
f_mount(NULL, drv, 0);
@ -160,10 +160,11 @@ esp_err_t esp_vfs_fat_sdmmc_unmount()
char drv[3] = {(char)('0' + s_pdrv), ':', 0};
f_mount(0, drv, 0);
// release SD driver
esp_err_t (*host_deinit)() = s_card->host.deinit;
ff_diskio_unregister(s_pdrv);
free(s_card);
s_card = NULL;
sdmmc_host_deinit();
(*host_deinit)();
esp_err_t err = esp_vfs_fat_unregister_path(s_base_path);
free(s_base_path);
s_base_path = NULL;