Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 378382b8 authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Ulf Hansson
Browse files

mmc: sdhci-pltfm: move devm_ioremap_resource() up



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: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent e30568d4
Loading
Loading
Loading
Loading
+5 −8
Original line number Original line Diff line number Diff line
@@ -119,11 +119,13 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
{
{
	struct sdhci_host *host;
	struct sdhci_host *host;
	struct resource *iomem;
	struct resource *iomem;
	void __iomem *ioaddr;
	int ret;
	int ret;


	iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	if (!iomem) {
	ioaddr = devm_ioremap_resource(&pdev->dev, iomem);
		ret = -ENOMEM;
	if (IS_ERR(ioaddr)) {
		ret = PTR_ERR(ioaddr);
		goto err;
		goto err;
	}
	}


@@ -135,6 +137,7 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
		goto err;
		goto err;
	}
	}


	host->ioaddr = ioaddr;
	host->hw_name = dev_name(&pdev->dev);
	host->hw_name = dev_name(&pdev->dev);
	if (pdata && pdata->ops)
	if (pdata && pdata->ops)
		host->ops = pdata->ops;
		host->ops = pdata->ops;
@@ -152,12 +155,6 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
		goto err_request;
		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
	 * Some platforms need to probe the controller to be able to
	 * determine which caps should be used.
	 * determine which caps should be used.