linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mmc: sdhci: add error checking for mmc_add_host
@ 2011-04-04  6:07 Jaehoon Chung
  2011-04-04 13:28 ` Wolfram Sang
  0 siblings, 1 reply; 3+ messages in thread
From: Jaehoon Chung @ 2011-04-04  6:07 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: kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/mmc/host/sdhci.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 9e15f41..7070716 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,11 +2038,19 @@ int sdhci_add_host(struct sdhci_host *host)
 
 	return 0;
 
+err_free_mmc:
+	mmc_free_host(host);
+
 #ifdef SDHCI_USE_LEDS_CLASS
 reset:
+#endif
 	sdhci_reset(host, SDHCI_RESET_ALL);
 	free_irq(host->irq, host);
-#endif
+	if (host->vmmc) {
+		regulator_disable(host->vmmc);
+		regulator_put(host->vmmc);
+	}
+
 untasklet:
 	tasklet_kill(&host->card_tasklet);
 	tasklet_kill(&host->finish_tasklet);

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

* Re: [PATCH v2] mmc: sdhci: add error checking for mmc_add_host
  2011-04-04  6:07 [PATCH v2] mmc: sdhci: add error checking for mmc_add_host Jaehoon Chung
@ 2011-04-04 13:28 ` Wolfram Sang
  2011-04-04 13:32   ` Wolfram Sang
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfram Sang @ 2011-04-04 13:28 UTC (permalink / raw)
  To: Jaehoon Chung; +Cc: linux-mmc@vger.kernel.org, Chris Ball, Kyungmin Park

[-- Attachment #1: Type: text/plain, Size: 794 bytes --]

On Mon, Apr 04, 2011 at 03:07:02PM +0900, Jaehoon Chung wrote:
> 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: kyungmin Park <kyungmin.park@samsung.com>
> ---

Please add here what changed since the last revision.

You are still leaking the led_classdev. Why do you free the mmc_host when
registering it failed? Looking at the remove function as comparison, there are
still some buffers, timers, etc, forgotten :( Could you fix that, too, please?

Regards,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [PATCH v2] mmc: sdhci: add error checking for mmc_add_host
  2011-04-04 13:28 ` Wolfram Sang
@ 2011-04-04 13:32   ` Wolfram Sang
  0 siblings, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2011-04-04 13:32 UTC (permalink / raw)
  To: Jaehoon Chung; +Cc: linux-mmc@vger.kernel.org, Chris Ball, Kyungmin Park

[-- Attachment #1: Type: text/plain, Size: 439 bytes --]

> registering it failed? Looking at the remove function as comparison, there are
> still some buffers, timers, etc, forgotten :( Could you fix that, too, please?

To avoid misunderstandings, that sad smiley didn't mean you but the state of
the current error-path in general.

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

end of thread, other threads:[~2011-04-04 13:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-04  6:07 [PATCH v2] mmc: sdhci: add error checking for mmc_add_host Jaehoon Chung
2011-04-04 13:28 ` Wolfram Sang
2011-04-04 13:32   ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).