All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] mmc: core: fix error path in mmc_host_alloc
       [not found] <dfed7598-7c82-c7d4-1f0b-3c5548adb377@gmail.com>
@ 2017-01-28  8:32 ` Heiner Kallweit
  2017-01-30 10:05   ` Ulf Hansson
  0 siblings, 1 reply; 2+ messages in thread
From: Heiner Kallweit @ 2017-01-28  8:32 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc

Properly reverse everything if mmc_gpio_alloc(host) fails.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/mmc/core/host.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 0a26c8b6..19c68bf2 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -369,6 +369,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;
 	}
 
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2] mmc: core: fix error path in mmc_host_alloc
  2017-01-28  8:32 ` [PATCH 2/2] mmc: core: fix error path in mmc_host_alloc Heiner Kallweit
@ 2017-01-30 10:05   ` Ulf Hansson
  0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2017-01-30 10:05 UTC (permalink / raw)
  To: Heiner Kallweit; +Cc: linux-mmc

On 28 January 2017 at 09:32, Heiner Kallweit <hkallweit1@gmail.com> wrote:
> Properly reverse everything if mmc_gpio_alloc(host) fails.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Thanks, applied for next!

Kind regards
Uffe

> ---
>  drivers/mmc/core/host.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> index 0a26c8b6..19c68bf2 100644
> --- a/drivers/mmc/core/host.c
> +++ b/drivers/mmc/core/host.c
> @@ -369,6 +369,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;
>         }
>
> --
> 2.11.0
>
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-30 11:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <dfed7598-7c82-c7d4-1f0b-3c5548adb377@gmail.com>
2017-01-28  8:32 ` [PATCH 2/2] mmc: core: fix error path in mmc_host_alloc Heiner Kallweit
2017-01-30 10:05   ` Ulf Hansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.