]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mmc: core: fix error path in mmc_host_alloc
authorHeiner Kallweit <hkallweit1@gmail.com>
Sat, 28 Jan 2017 08:32:50 +0000 (09:32 +0100)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 13 Feb 2017 12:20:48 +0000 (13:20 +0100)
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>
drivers/mmc/core/host.c

index 1708818549752fe2dcb3f52e704e6651636e0767..3f8c85d5aa094b43666904c7dbbe5e62c9763c19 100644 (file)
@@ -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;
        }