From 1ed2171944888cf6787990a0f6387b717ba72e24 Mon Sep 17 00:00:00 2001 From: Heiner Kallweit Date: Sat, 28 Jan 2017 09:32:50 +0100 Subject: 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 --- drivers/mmc/core/host.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers') 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; } -- cgit v1.2.3