From patchwork Mon Apr 11 02:11:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaehoon Chung X-Patchwork-Id: 697341 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3B2DMIT015136 for ; Mon, 11 Apr 2011 02:13:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753965Ab1DKCNT (ORCPT ); Sun, 10 Apr 2011 22:13:19 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:46128 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753671Ab1DKCNS (ORCPT ); Sun, 10 Apr 2011 22:13:18 -0400 Received: from epmmp1 (mailout4.samsung.com [203.254.224.34]) by mailout4.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTP id <0LJG00LDVU5GPH30@mailout4.samsung.com> for linux-mmc@vger.kernel.org; Mon, 11 Apr 2011 11:12:52 +0900 (KST) Received: from TNRNDGASPAPP1.tn.corp.samsungelectronics.net ([165.213.149.150]) by mmp1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LJG001EMU5GTM@mmp1.samsung.com> for linux-mmc@vger.kernel.org; Mon, 11 Apr 2011 11:12:52 +0900 (KST) Received: from [165.213.219.108] ([165.213.219.108]) by TNRNDGASPAPP1.tn.corp.samsungelectronics.net with Microsoft SMTPSVC(6.0.3790.4675); Mon, 11 Apr 2011 11:12:52 +0900 Date: Mon, 11 Apr 2011 11:11:08 +0900 From: Jaehoon Chung Subject: [PATCH v4] mmc: sdhci: add error checking for mmc_add_host To: "linux-mmc@vger.kernel.org" Cc: Chris Ball , Wolfram Sang , Kyungmin Park Message-id: <4DA2633C.5000103@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 7BIT User-Agent: Thunderbird 2.0.0.24 (X11/20100317) X-OriginalArrivalTime: 11 Apr 2011 02:12:52.0195 (UTC) FILETIME=[F6502B30:01CBF7ED] Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 11 Apr 2011 02:13:23 +0000 (UTC) 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 Signed-off-by: Kyungmin Park --- drivers/mmc/host/sdhci.c | 22 ++++++++++++++++++++-- 1 files changed, 20 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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; }