From patchwork Wed Apr 20 02:16:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 66159 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2195206qge; Tue, 19 Apr 2016 19:16:26 -0700 (PDT) X-Received: by 10.98.88.68 with SMTP id m65mr8751601pfb.4.1461118586655; Tue, 19 Apr 2016 19:16:26 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t10si12271060paw.5.2016.04.19.19.16.26; Tue, 19 Apr 2016 19:16:26 -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 S1754304AbcDTCQK (ORCPT + 2 others); Tue, 19 Apr 2016 22:16:10 -0400 Received: from conuserg-11.nifty.com ([210.131.2.78]:38431 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751791AbcDTCQD (ORCPT ); Tue, 19 Apr 2016 22:16:03 -0400 Received: from beagle.diag.org (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-11.nifty.com with ESMTP id u3K2FZ7k005192; Wed, 20 Apr 2016 11:15:41 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com u3K2FZ7k005192 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1461118541; bh=KzjttfOyqWU9JeHxntLxTZwBy4nS9oUbtJCNy1en94Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eblr5k8BY+US44aXaZ696Nj/SNOBgTvTUzuyVjB+dI6iMLJXNKeKnKSjpC1WHSpwk ZcfAG1ayiZWZtjece+PRIC/GrMP6kA3LpmJ7K+odq4Je5monJIRy7oNHbDI7+GMSQ1 MMspSAM4YxkUvwf8DVhcYc1WbOD8QIqpe8FeicdOQ9M1VQI5s9RKTd0qXlhsvwQ9ZQ E0bMJhsaN7kxGA0DwhS2NvOdvpUudD4ME2zn2YKYDPsKoEeGfFUr7RepBGPGP7CWNi ROBJl95FnNtXouggvfupZFHPqYKE3xJF2Zvzz6s3t6Q2yoEk89X9SmPTeiLlVD7FMd YdJnrcCoihaJw== 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 v2 6/7] mmc: sdhci-pltfm: move devm_ioremap_resource() up Date: Wed, 20 Apr 2016 11:16:30 +0900 Message-Id: <1461118591-21595-7-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461118591-21595-1-git-send-email-yamada.masahiro@socionext.com> References: <1461118591-21595-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 Call devm_ioremap_resource() right after platform_get_resource(). This saves the error check of platform_get_resource() because devm_ioremap_resource() checks if the given resource is NULL. Signed-off-by: Masahiro Yamada --- Changes in v2: None drivers/mmc/host/sdhci-pltfm.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 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 caa05d7..1d74db8 100644 --- a/drivers/mmc/host/sdhci-pltfm.c +++ b/drivers/mmc/host/sdhci-pltfm.c @@ -119,11 +119,13 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev, { struct sdhci_host *host; struct resource *iomem; + void __iomem *ioaddr; int ret; iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!iomem) { - ret = -ENOMEM; + ioaddr = devm_ioremap_resource(&pdev->dev, iomem); + if (IS_ERR(ioaddr)) { + ret = PTR_ERR(ioaddr); goto err; } @@ -135,6 +137,7 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev, goto err; } + host->ioaddr = ioaddr; host->hw_name = dev_name(&pdev->dev); if (pdata && pdata->ops) host->ops = pdata->ops; @@ -152,12 +155,6 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev, goto err_request; } - host->ioaddr = devm_ioremap_resource(&pdev->dev, iomem); - if (IS_ERR(host->ioaddr)) { - ret = PTR_ERR(host->ioaddr); - goto err_request; - } - /* * Some platforms need to probe the controller to be able to * determine which caps should be used.