From: Heiner Kallweit Date: Sat, 28 Jan 2017 08:32:50 +0000 (+0100) Subject: mmc: core: fix error path in mmc_host_alloc X-Git-Tag: v4.11-rc1~140^2~41 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=1ed2171944888cf6787990a0f6387b717ba72e24;p=linux.git mmc: core: fix error path in mmc_host_alloc Properly reverse everything if mmc_gpio_alloc(host) fails. Signed-off-by: Heiner Kallweit Signed-off-by: Ulf Hansson --- 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; }