diff options
author | Wei WANG <wei_wang@realsil.com.cn> | 2013-07-17 10:21:10 +0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2013-08-25 06:53:30 +0400 |
commit | 7fca96758e977497c67a424006c60aaf2d3db212 (patch) | |
tree | 24d59d1530a6d580008efe3b70d2e0fe712f71b3 /drivers/mmc/core/sd.c | |
parent | 0506bc57f5f48200d00c153c403dc340eb092e4e (diff) | |
download | linux-7fca96758e977497c67a424006c60aaf2d3db212.tar.xz |
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: Wei WANG <wei_wang@realsil.com.cn>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/core/sd.c')
-rw-r--r-- | drivers/mmc/core/sd.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 176d125f5b57..1240a85a9aa2 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -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); |