From: Chris Ball <cjb@laptop.org>
To: Wolfram Sang <w.sang@pengutronix.de>
Cc: linux-mmc@vger.kernel.org, linus.walleij@linaro.org
Subject: Re: [PATCH] mmc: host: fix memory leak in mmc_add_host
Date: Mon, 11 Apr 2011 17:25:48 -0400 [thread overview]
Message-ID: <m3ei58a3ab.fsf@pullcord.laptop.org> (raw)
In-Reply-To: <1302495089-23699-1-git-send-email-w.sang@pengutronix.de> (Wolfram Sang's message of "Mon, 11 Apr 2011 06:11:29 +0200")
Hi Wolfram,
On Mon, Apr 11 2011, Wolfram Sang wrote:
> led_trigger_register_simple() allocates memory which must not be leaked
> in the error-path of mmc_add_host. Move it past the only error-check in
> the function.
>
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> ---
>
> I don't see any reason why it needs to be called before device_add.
>
> drivers/mmc/core/host.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> index 461e6a1..b29d3e8 100644
> --- a/drivers/mmc/core/host.c
> +++ b/drivers/mmc/core/host.c
> @@ -325,12 +325,12 @@ int mmc_add_host(struct mmc_host *host)
> WARN_ON((host->caps & MMC_CAP_SDIO_IRQ) &&
> !host->ops->enable_sdio_irq);
>
> - led_trigger_register_simple(dev_name(&host->class_dev), &host->led);
> -
> err = device_add(&host->class_dev);
> if (err)
> return err;
>
> + led_trigger_register_simple(dev_name(&host->class_dev), &host->led);
> +
> #ifdef CONFIG_DEBUG_FS
> mmc_add_host_debugfs(host);
> #endif
Thanks, pushed to mmc-next for .40.
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
prev parent reply other threads:[~2011-04-11 21:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-11 4:11 [PATCH] mmc: host: fix memory leak in mmc_add_host Wolfram Sang
2011-04-11 21:25 ` 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=m3ei58a3ab.fsf@pullcord.laptop.org \
--to=cjb@laptop.org \
--cc=linus.walleij@linaro.org \
--cc=linux-mmc@vger.kernel.org \
--cc=w.sang@pengutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).