From patchwork Thu Apr 14 02:29:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 65769 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp346878qge; Wed, 13 Apr 2016 19:29:33 -0700 (PDT) X-Received: by 10.98.16.22 with SMTP id y22mr17906337pfi.50.1460600973169; Wed, 13 Apr 2016 19:29:33 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w13si6608626pas.67.2016.04.13.19.29.32; Wed, 13 Apr 2016 19:29:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753565AbcDNC3a (ORCPT + 2 others); Wed, 13 Apr 2016 22:29:30 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:40503 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751836AbcDNC33 (ORCPT ); Wed, 13 Apr 2016 22:29:29 -0400 Received: from beagle.diag.org (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id u3E2Sr3i010961; Thu, 14 Apr 2016 11:28:59 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com u3E2Sr3i010961 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1460600940; bh=NyWU7m06+KieeCjTv+gaRoP44oS2iNJuK/eI21zcKbs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YMdf+H3spzI+s6cq5lyuNaz5LF+hAzX4XO3Pv7jMafQqA3fiQu9h/AOKoA0x2wkmF 1kOnAE/aYU2EC0psoUJviXg0sNUe97m/MxKZuXnmfH6+J2WPRjku1kUf54vqsExlzN lsFI57XvofFHNE7v4B/Flc9Uj5sDuD/7DrIGkX6GhBRLjTqCPBWlXKGeBb2Lme3jpC PIrNUVLRwanpeaPdO2vFK/pHN7pYvYU87EiGQAyENfJXh9MDia+mg5JONSsKsIYZiw OxseMpnI0npykV6OTLbMeZl+aFjaKSHGsb8J5K8iQXIi+ZqjMcFiWMXhDPiUANBvqg okmgiNZb9rLmQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mmc@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org, Adrian Hunter , Ulf Hansson Subject: [PATCH 7/7] mmc: sdhci-pltfm: call platform_get_irq() before sdhci_alloc_host() Date: Thu, 14 Apr 2016 11:29:50 +0900 Message-Id: <1460600990-10993-8-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1460600990-10993-1-git-send-email-yamada.masahiro@socionext.com> References: <1460600990-10993-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Swap the call order of sdhci_alloc_host() and platform_get_irq(). It makes sdhci_alloc_host() the last function that can fail in this probe method. So, we can drop the sdhci_free_host() call from the failure path. Signed-off-by: Masahiro Yamada --- drivers/mmc/host/sdhci-pltfm.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) -- 1.9.1 -- 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-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c index 870c3d7..94bdca8 100644 --- a/drivers/mmc/host/sdhci-pltfm.c +++ b/drivers/mmc/host/sdhci-pltfm.c @@ -120,7 +120,7 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev, struct sdhci_host *host; struct resource *iomem; void __iomem *ioaddr; - int ret; + int irq, ret; iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); ioaddr = devm_ioremap_resource(&pdev->dev, iomem); @@ -135,6 +135,13 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev, goto err; } + irq = platform_get_irq(pdev, 0); + if (irq < 0) { + dev_err(&pdev->dev, "failed to get IRQ number"); + ret = irq; + goto err; + } + host = sdhci_alloc_host(&pdev->dev, sizeof(struct sdhci_pltfm_host) + priv_size); @@ -144,6 +151,7 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev, } host->ioaddr = ioaddr; + host->irq = irq; host->hw_name = dev_name(&pdev->dev); if (pdata && pdata->ops) host->ops = pdata->ops; @@ -154,13 +162,6 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev, host->quirks2 = pdata->quirks2; } - host->irq = platform_get_irq(pdev, 0); - if (host->irq < 0) { - dev_err(&pdev->dev, "failed to get IRQ number"); - ret = host->irq; - goto err_request; - } - /* * Some platforms need to probe the controller to be able to * determine which caps should be used. @@ -171,9 +172,6 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev, platform_set_drvdata(pdev, host); return host; - -err_request: - sdhci_free_host(host); err: dev_err(&pdev->dev, "%s failed %d\n", __func__, ret); return ERR_PTR(ret);