From: Fabio Estevam <fabio.estevam@freescale.com>
Date: Mon, 17 Feb 2014 22:05:56 +0000 (-0300)
Subject: pata_imx: Use devm_ioremap_resource() to simplify code
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b314fc7754119e12974210f06e04cd7a15206fee;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git

pata_imx: Use devm_ioremap_resource() to simplify code

Using devm_ioremap_resource() can lead to code simplication, as we don't need
to explicitily check for error returned by platform_get_resource().

Also, no need to print an error message when devm_ioremap_resource() fails,
as the OOM code code will shout loudly on such condition.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
---

diff --git a/drivers/ata/pata_imx.c b/drivers/ata/pata_imx.c
index 97417d5d8b42..50e2cf29721e 100644
--- a/drivers/ata/pata_imx.c
+++ b/drivers/ata/pata_imx.c
@@ -99,10 +99,6 @@ static int pata_imx_probe(struct platform_device *pdev)
 	struct resource *io_res;
 	int ret;
 
-	io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (io_res == NULL)
-		return -EINVAL;
-
 	irq = platform_get_irq(pdev, 0);
 	if (irq <= 0)
 		return -EINVAL;
@@ -133,10 +129,9 @@ static int pata_imx_probe(struct platform_device *pdev)
 	ap->pio_mask = ATA_PIO0;
 	ap->flags |= ATA_FLAG_SLAVE_POSS;
 
-	priv->host_regs = devm_ioremap(&pdev->dev, io_res->start,
-		resource_size(io_res));
+	io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	priv->host_regs = devm_ioremap_resource(&pdev->dev, io_res);
 	if (!priv->host_regs) {
-		dev_err(&pdev->dev, "failed to map IO/CTL base\n");
 		ret = -EBUSY;
 		goto err;
 	}