From: Chris Ball <cjb@laptop.org>
To: wei_wang@realsil.com.cn
Cc: devel@linuxdriverproject.org, linux-mmc@vger.kernel.org
Subject: Re: [PATCH] mmc/core: free mmc_card when cmd 3,9,7 got failed in mmc_sd_init_card
Date: Sat, 24 Aug 2013 22:53:50 -0400 [thread overview]
Message-ID: <87wqnascox.fsf@octavius.laptop.org> (raw)
In-Reply-To: <1374042070-32765-1-git-send-email-wei_wang@realsil.com.cn> (wei wang's message of "Wed, 17 Jul 2013 14:21:10 +0800")
Hi Wei,
On Wed, Jul 17 2013, wei_wang@realsil.com.cn wrote:
> From: Wei WANG <wei_wang@realsil.com.cn>
>
> 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>
> ---
> drivers/mmc/core/sd.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
> index 176d125..1240a85 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);
Thanks, pushed to mmc-next for 3.12.
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
prev parent reply other threads:[~2013-08-25 2:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-17 6:21 [PATCH] mmc/core: free mmc_card when cmd 3,9,7 got failed in mmc_sd_init_card wei_wang
2013-08-25 2:53 ` Chris Ball [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wqnascox.fsf@octavius.laptop.org \
--to=cjb@laptop.org \
--cc=devel@linuxdriverproject.org \
--cc=linux-mmc@vger.kernel.org \
--cc=wei_wang@realsil.com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.