public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/2] mmc: sdhci: add error checking for mmc_add_host
@ 2011-04-05  8:02 Jaehoon Chung
  2011-04-08 18:31 ` Wolfram Sang
  0 siblings, 1 reply; 3+ messages in thread
From: Jaehoon Chung @ 2011-04-05  8:02 UTC (permalink / raw)
  To: linux-mmc@vger.kernel.org; +Cc: Chris Ball, Wolfram Sang, Kyungmin Park

Sometimes we can't add the device,but we didn't check any error status.
Need to check error status for mmc_add_host.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungin Park <kyungmin.park@samsung.com>
---
 drivers/mmc/host/sdhci.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 9e15f41..1768ffb 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,29 @@ 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);
+
 untasklet:
 	tasklet_kill(&host->card_tasklet);
 	tasklet_kill(&host->finish_tasklet);
 
+	if (host->flags & SDHCI_USE_ADMA) {
+		kfree(host->adma_desc);
+		kfree(host->align_buffer);
+
+		host->adma_desc = NULL;
+		host->align_buffer = NULL;
+	}
+
 	return ret;
 }
 

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

end of thread, other threads:[~2011-04-09 11:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-05  8:02 [PATCH v3 1/2] mmc: sdhci: add error checking for mmc_add_host Jaehoon Chung
2011-04-08 18:31 ` Wolfram Sang
2011-04-09 11:49   ` Jae hoon Chung

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox