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.14-rc1~1479^2~41 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1ed2171944888cf6787990a0f6387b717ba72e24;p=platform%2Fkernel%2Flinux-rpi.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 1708818..3f8c85d 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; }