Commit 7fca9675 authored by Wei WANG's avatar Wei WANG Committed by Chris Ball

mmc: core: free mmc_card if cmd 3,9,7 fails in mmc_sd_init_card

In function mmc_sd_init_card, if command 3/9/7 got failed, mmc_card
allocated just before won't be freed. This would cause memory leak.
Signed-off-by: default avatarWei WANG <wei_wang@realsil.com.cn>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent 0506bc57
......@@ -942,13 +942,13 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
if (!mmc_host_is_spi(host)) {
err = mmc_send_relative_addr(host, &card->rca);
if (err)
return err;
goto free_card;
}
if (!oldcard) {
err = mmc_sd_get_csd(host, card);
if (err)
return err;
goto free_card;
mmc_decode_cid(card);
}
......@@ -959,7 +959,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
if (!mmc_host_is_spi(host)) {
err = mmc_select_card(card);
if (err)
return err;
goto free_card;
}
err = mmc_sd_setup_card(host, card, oldcard != NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment