summaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2017-01-28 09:32:50 +0100
committerUlf Hansson <ulf.hansson@linaro.org>2017-02-13 13:20:48 +0100
commit1ed2171944888cf6787990a0f6387b717ba72e24 (patch)
tree3f6eca73872a2f02945a493385d4f05266ef8240 /drivers/mmc/core
parent7413d1f509eb0ee605973c1a6da9911700c80012 (diff)
downloadlinux-1ed2171944888cf6787990a0f6387b717ba72e24.tar.bz2
mmc: core: fix error path in mmc_host_alloc
Properly reverse everything if mmc_gpio_alloc(host) fails. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/core')
-rw-r--r--drivers/mmc/core/host.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 170881854975..3f8c85d5aa09 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -371,6 +371,8 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
if (mmc_gpio_alloc(host)) {
put_device(&host->class_dev);
+ ida_simple_remove(&mmc_host_ida, host->index);
+ kfree(host);
return NULL;
}