Commit ff540d02 authored by Sascha Hauer's avatar Sascha Hauer Committed by Jeff Garzik

pata_imx: cleanup error path

- rename free_priv label to 'err' since priv is allocated with devm_*
  and not freed here.
- add missing 'goto err' in case ata_host_activate fails
- add 'ret' variable to return correct error value instead of hardcoded
  -ENOMEM in error case.
Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent 50f5a341
...@@ -98,6 +98,7 @@ static int pata_imx_probe(struct platform_device *pdev) ...@@ -98,6 +98,7 @@ static int pata_imx_probe(struct platform_device *pdev)
struct pata_imx_priv *priv; struct pata_imx_priv *priv;
int irq = 0; int irq = 0;
struct resource *io_res; struct resource *io_res;
int ret;
io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (io_res == NULL) if (io_res == NULL)
...@@ -121,8 +122,10 @@ static int pata_imx_probe(struct platform_device *pdev) ...@@ -121,8 +122,10 @@ static int pata_imx_probe(struct platform_device *pdev)
clk_prepare_enable(priv->clk); clk_prepare_enable(priv->clk);
host = ata_host_alloc(&pdev->dev, 1); host = ata_host_alloc(&pdev->dev, 1);
if (!host) if (!host) {
goto free_priv; ret = -ENOMEM;
goto err;
}
host->private_data = priv; host->private_data = priv;
ap = host->ports[0]; ap = host->ports[0];
...@@ -135,7 +138,8 @@ static int pata_imx_probe(struct platform_device *pdev) ...@@ -135,7 +138,8 @@ static int pata_imx_probe(struct platform_device *pdev)
resource_size(io_res)); resource_size(io_res));
if (!priv->host_regs) { if (!priv->host_regs) {
dev_err(&pdev->dev, "failed to map IO/CTL base\n"); dev_err(&pdev->dev, "failed to map IO/CTL base\n");
goto free_priv; ret = -EBUSY;
goto err;
} }
ap->ioaddr.cmd_addr = priv->host_regs + PATA_IMX_DRIVE_DATA; ap->ioaddr.cmd_addr = priv->host_regs + PATA_IMX_DRIVE_DATA;
...@@ -158,13 +162,17 @@ static int pata_imx_probe(struct platform_device *pdev) ...@@ -158,13 +162,17 @@ static int pata_imx_probe(struct platform_device *pdev)
priv->host_regs + PATA_IMX_ATA_INT_EN); priv->host_regs + PATA_IMX_ATA_INT_EN);
/* activate */ /* activate */
return ata_host_activate(host, irq, ata_sff_interrupt, 0, ret = ata_host_activate(host, irq, ata_sff_interrupt, 0,
&pata_imx_sht); &pata_imx_sht);
free_priv: if (ret)
goto err;
return 0;
err:
clk_disable_unprepare(priv->clk); clk_disable_unprepare(priv->clk);
return -ENOMEM; return ret;
} }
static int pata_imx_remove(struct platform_device *pdev) static int pata_imx_remove(struct platform_device *pdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment