From db4f16754f49fef4445f285aa66372a3f846e971 Mon Sep 17 00:00:00 2001 From: Mateusz Faderewski Date: Sun, 29 Sep 2024 21:14:32 +0200 Subject: [PATCH] [SC64][SW] Release SD lock on init error --- sw/controller/src/cfg.c | 3 +++ sw/controller/src/usb.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/sw/controller/src/cfg.c b/sw/controller/src/cfg.c index d7db3f8..29cec9e 100644 --- a/sw/controller/src/cfg.c +++ b/sw/controller/src/cfg.c @@ -655,6 +655,9 @@ void cfg_process (void) { led_activity_on(); error = sd_card_init(); led_activity_off(); + if (error != SD_OK) { + sd_release_lock(SD_LOCK_N64); + } } break; diff --git a/sw/controller/src/usb.c b/sw/controller/src/usb.c index 70a1a1a..99f9a0b 100644 --- a/sw/controller/src/usb.c +++ b/sw/controller/src/usb.c @@ -404,6 +404,9 @@ static void usb_rx_process (void) { led_activity_on(); error = sd_card_init(); led_activity_off(); + if (error != SD_OK) { + sd_release_lock(SD_LOCK_USB); + } } break;