From 7d7993f940aa2708eb7f0074140e6e8db99be92c Mon Sep 17 00:00:00 2001 From: Evlers <1425295900@qq.com> Date: Fri, 5 Jul 2024 00:09:11 +0800 Subject: [PATCH] fix an issue where repeated remove of card resulted in assertions --- components/drivers/sdio/sdio.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/components/drivers/sdio/sdio.c b/components/drivers/sdio/sdio.c index d1705d43c3..bc1951792f 100644 --- a/components/drivers/sdio/sdio.c +++ b/components/drivers/sdio/sdio.c @@ -6,6 +6,7 @@ * Change Logs: * Date Author Notes * 2012-01-13 weety first version + * 2024-04-04 Evlers fix an issue where repeated remove of card resulted in assertions */ #include @@ -951,6 +952,7 @@ err1: if (host->card) { rt_free(host->card); + host->card = RT_NULL; } err: LOG_E("error %d while initialising SDIO card", err); @@ -987,13 +989,10 @@ rt_int32_t init_sdio(struct rt_mmcsd_host *host, rt_uint32_t ocr) err = sdio_init_card(host, current_ocr); if (err) - goto remove_card; + goto err; return 0; -remove_card: - rt_free(host->card); - host->card = RT_NULL; err: LOG_E("init SDIO card failed");