Skip to content

Commit

Permalink
ata: sata_mv: Convert to devm_ioremap_resource()
Browse files Browse the repository at this point in the history
Convert to devm_ioremap_resource() which provides more consistent error
handling.

Note that devm_ioremap_resource() provides its own error messages.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
  • Loading branch information
Andy Shevchenko authored and Tejun Heo committed Jan 9, 2017
1 parent 0fe4618 commit 368e5fb
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions drivers/ata/sata_mv.c
Original file line number Diff line number Diff line change
Expand Up @@ -4067,6 +4067,7 @@ static int mv_platform_probe(struct platform_device *pdev)
struct ata_host *host;
struct mv_host_priv *hpriv;
struct resource *res;
void __iomem *mmio;
int n_ports = 0, irq = 0;
int rc;
int port;
Expand All @@ -4085,8 +4086,9 @@ static int mv_platform_probe(struct platform_device *pdev)
* Get the register base first
*/
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res == NULL)
return -EINVAL;
mmio = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(mmio))
return PTR_ERR(mmio);

/* allocate host */
if (pdev->dev.of_node) {
Expand Down Expand Up @@ -4130,12 +4132,7 @@ static int mv_platform_probe(struct platform_device *pdev)
hpriv->board_idx = chip_soc;

host->iomap = NULL;
hpriv->base = devm_ioremap(&pdev->dev, res->start,
resource_size(res));
if (!hpriv->base)
return -ENOMEM;

hpriv->base -= SATAHC0_REG_BASE;
hpriv->base = mmio - SATAHC0_REG_BASE;

hpriv->clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(hpriv->clk))
Expand Down

0 comments on commit 368e5fb

Please sign in to comment.