All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc@vger.kernel.org
Subject: [PATCH 2/2] mmc: core: fix error path in mmc_host_alloc
Date: Sat, 28 Jan 2017 09:32:50 +0100	[thread overview]
Message-ID: <92cb6f74-a354-d4ab-6e40-1d985526e68f@gmail.com> (raw)
In-Reply-To: <dfed7598-7c82-c7d4-1f0b-3c5548adb377@gmail.com>

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



       reply	other threads:[~2017-01-28  8:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <dfed7598-7c82-c7d4-1f0b-3c5548adb377@gmail.com>
2017-01-28  8:32 ` Heiner Kallweit [this message]
2017-01-30 10:05   ` [PATCH 2/2] mmc: core: fix error path in mmc_host_alloc Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=92cb6f74-a354-d4ab-6e40-1d985526e68f@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.