diff options
author | Fabio Estevam <fabio.estevam@freescale.com> | 2014-02-17 17:05:56 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2014-02-18 17:39:54 -0500 |
commit | b314fc7754119e12974210f06e04cd7a15206fee (patch) | |
tree | f5edc83076358d8592c80920a8d92d7e5383b229 | |
parent | 1bc18086231c130895b87ec049be8ddcdab552b8 (diff) |
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>
-rw-r--r-- | drivers/ata/pata_imx.c | 9 |
1 files changed, 2 insertions, 7 deletions
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) | |||
99 | struct resource *io_res; | 99 | struct resource *io_res; |
100 | int ret; | 100 | int ret; |
101 | 101 | ||
102 | io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
103 | if (io_res == NULL) | ||
104 | return -EINVAL; | ||
105 | |||
106 | irq = platform_get_irq(pdev, 0); | 102 | irq = platform_get_irq(pdev, 0); |
107 | if (irq <= 0) | 103 | if (irq <= 0) |
108 | return -EINVAL; | 104 | return -EINVAL; |
@@ -133,10 +129,9 @@ static int pata_imx_probe(struct platform_device *pdev) | |||
133 | ap->pio_mask = ATA_PIO0; | 129 | ap->pio_mask = ATA_PIO0; |
134 | ap->flags |= ATA_FLAG_SLAVE_POSS; | 130 | ap->flags |= ATA_FLAG_SLAVE_POSS; |
135 | 131 | ||
136 | priv->host_regs = devm_ioremap(&pdev->dev, io_res->start, | 132 | io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
137 | resource_size(io_res)); | 133 | priv->host_regs = devm_ioremap_resource(&pdev->dev, io_res); |
138 | if (!priv->host_regs) { | 134 | if (!priv->host_regs) { |
139 | dev_err(&pdev->dev, "failed to map IO/CTL base\n"); | ||
140 | ret = -EBUSY; | 135 | ret = -EBUSY; |
141 | goto err; | 136 | goto err; |
142 | } | 137 | } |