Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1383004

[PATCH v2 6/7] mmc: sdhci-pltfm: move devm_ioremap_resource() up

From Masahiro Yamada <yamada.masahiro@socionext.com>
Newsgroups linux.kernel
Subject [PATCH v2 6/7] mmc: sdhci-pltfm: move devm_ioremap_resource() up
Date 2016-04-20 04:20 +0200
Message-ID <rpPUe-oM-13@gated-at.bofh.it> (permalink)
References <rpPUe-oM-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 <yamada.masahiro@socionext.com>
---

Changes in v2: None

 drivers/mmc/host/sdhci-pltfm.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

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.
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/7] mmc: sdhci-pltfm: fix and tidy up sdhci_pltfm_init() Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-04-20 04:20 +0200
  [PATCH v2 2/7] mmc: sdhci-pltfm: check return value of platform_get_irq() Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-04-20 04:20 +0200
  [PATCH v2 4/7] mmc: sdhci-pltfm: use devm_ioremap() Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-04-20 04:20 +0200
  [PATCH v2 3/7] mmc: sdhci-pltfm: use devm_request_mem_region() Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-04-20 04:20 +0200
  [PATCH v2 5/7] mmc: sdhci-pltfm: use devm_ioremap_resource() Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-04-20 04:20 +0200
  [PATCH v2 1/7] mmc: sdhci-pltfm: drop error message for too small MMIO resource size Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-04-20 04:20 +0200
  [PATCH v2 7/7] mmc: sdhci-pltfm: call platform_get_irq() before sdhci_alloc_host() Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-04-20 04:20 +0200
  [PATCH v2 6/7] mmc: sdhci-pltfm: move devm_ioremap_resource() up Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-04-20 04:20 +0200
  Re: [PATCH v2 0/7] mmc: sdhci-pltfm: fix and tidy up  sdhci_pltfm_init() Adrian Hunter <adrian.hunter@intel.com> - 2016-04-20 08:20 +0200
  Re: [PATCH v2 0/7] mmc: sdhci-pltfm: fix and tidy up sdhci_pltfm_init() Ulf Hansson <ulf.hansson@linaro.org> - 2016-04-22 15:00 +0200

csiph-web