diff --git a/libraries/Portenta_SDCARD/src/SDMMCBlockDevice.cpp b/libraries/Portenta_SDCARD/src/SDMMCBlockDevice.cpp index 3b76bee57..96c37fa9d 100644 --- a/libraries/Portenta_SDCARD/src/SDMMCBlockDevice.cpp +++ b/libraries/Portenta_SDCARD/src/SDMMCBlockDevice.cpp @@ -115,6 +115,7 @@ int SDMMCBlockDevice::deinit() _sd_state = BSP_SD_DeInit (); if(_sd_state != MSD_OK) { debug_if (SD_DBG, "SD card deinitialization failed\n"); + unlock(); return SD_BLOCK_DEVICE_ERROR; } _is_initialized = false;