Skip to content

Commit

Permalink
fix an issue where repeated remove of card resulted in assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
Evlers authored and Rbb666 committed Jul 5, 2024
1 parent 95aa977 commit 7d7993f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions components/drivers/sdio/sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <drivers/mmcsd_core.h>
Expand Down Expand Up @@ -951,6 +952,7 @@ static rt_int32_t sdio_init_card(struct rt_mmcsd_host *host, rt_uint32_t ocr)
if (host->card)
{
rt_free(host->card);
host->card = RT_NULL;
}
err:
LOG_E("error %d while initialising SDIO card", err);
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 7d7993f

Please sign in to comment.