From: Jaehoon Chung <jh80.chung@samsung.com>
To: "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>
Cc: Chris Ball <cjb@laptop.org>, Wolfram Sang <w.sang@pengutronix.de>,
Kyungmin Park <kyungmin.park@samsung.com>
Subject: [PATCH v4] mmc: sdhci: add error checking for mmc_add_host
Date: Mon, 11 Apr 2011 11:11:08 +0900 [thread overview]
Message-ID: <4DA2633C.5000103@samsung.com> (raw)
Sometimes we can't add the device,but we didn't check any error status.
Need to check error status for mmc_add_host.
And Missing regulator disable/put. Fixed them.
[PATCH v4] : merged for v3 [PATCH 1/2] and [PATCH 2/2] reviewed on Wolfram Sang
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
drivers/mmc/host/sdhci.c | 22 ++++++++++++++++++++--
1 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 9e15f41..e9cb09c 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2025,7 +2025,9 @@ int sdhci_add_host(struct sdhci_host *host)
mmiowb();
- mmc_add_host(mmc);
+ ret = mmc_add_host(mmc);
+ if (unlikely(ret))
+ goto err_free_mmc;
printk(KERN_INFO "%s: SDHCI controller on %s [%s] using %s\n",
mmc_hostname(mmc), host->hw_name, dev_name(mmc_dev(mmc)),
@@ -2036,15 +2038,31 @@ int sdhci_add_host(struct sdhci_host *host)
return 0;
+err_free_mmc:
+ mmc_remove_host(host);
+
#ifdef SDHCI_USE_LEDS_CLASS
+ led_classdev_ungregister(&host->led);
reset:
+#endif
sdhci_reset(host, SDHCI_RESET_ALL);
free_irq(host->irq, host);
-#endif
+ del_timer_sync(&host->timer);
+ if (host->vmmc) {
+ regulator_disable(host->vmmc);
+ regulator_put(host->vmmc);
+ }
+
untasklet:
tasklet_kill(&host->card_tasklet);
tasklet_kill(&host->finish_tasklet);
+ kfree(host->adma_desc);
+ kfree(host->align_buffer);
+
+ host->adma_desc = NULL;
+ host->align_buffer = NULL;
+
return ret;
}
next reply other threads:[~2011-04-11 2:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-11 2:11 Jaehoon Chung [this message]
2011-04-11 3:04 ` [PATCH v4] mmc: sdhci: add error checking for mmc_add_host Wolfram Sang
2011-04-11 4:16 ` Jaehoon Chung
2011-04-11 4:40 ` Wolfram Sang
2011-04-11 4:55 ` Jaehoon Chung
2011-04-11 5:59 ` Wolfram Sang
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=4DA2633C.5000103@samsung.com \
--to=jh80.chung@samsung.com \
--cc=cjb@laptop.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-mmc@vger.kernel.org \
--cc=w.sang@pengutronix.de \
/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.