From 15609b042436b223cb1251fec38f1787f6331d53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20M=C3=BAdry?= Date: Tue, 2 Dec 2025 09:50:14 +0100 Subject: [PATCH] fix(sdmmc): Deinitialize only initialized slots (sdmmc_host_deinit function) Closes https://github.com/espressif/esp-idf/issues/17937 --- components/esp_driver_sdmmc/src/sdmmc_host.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/esp_driver_sdmmc/src/sdmmc_host.c b/components/esp_driver_sdmmc/src/sdmmc_host.c index c33479cb1cc..4a84723e212 100644 --- a/components/esp_driver_sdmmc/src/sdmmc_host.c +++ b/components/esp_driver_sdmmc/src/sdmmc_host.c @@ -929,7 +929,9 @@ esp_err_t sdmmc_host_deinit(void) return ESP_ERR_INVALID_STATE; } for (int slot = 0; slot < SOC_SDMMC_NUM_SLOTS; slot++) { - sdmmc_host_deinit_slot_internal(slot); + if (sdmmc_host_slot_initialized(slot)) { + sdmmc_host_deinit_slot_internal(slot); + } } sdmmc_host_deinit_internal();