summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWolfram Sang <w.sang@pengutronix.de>2011-04-11 06:11:29 +0200
committerChris Ball <cjb@laptop.org>2011-05-24 21:00:50 -0400
commitf317dfeb86c83d03304a74ce5426a69422b79547 (patch)
treec5f313b1afcc4318c7d86dd243fb8867b01ffb05
parentb177bc9188c04e140e5d8928e88623a92ba751bf (diff)
downloadlinux-f317dfeb86c83d03304a74ce5426a69422b79547.tar.bz2
mmc: core: fix memory leak in mmc_add_host
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> Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r--drivers/mmc/core/host.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 2b200c1cfbba..6714ea4e46ea 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -324,12 +324,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