Re: [PATCH] mmc: host: fix memory leak in mmc_add_host

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
> ---
>
> 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@xxxxxxxxxx>   <http://printf.net/>
One Laptop Per Child
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux