aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-04-04 05:25:05 -0400
committerJeff Garzik <jgarzik@redhat.com>2013-04-11 19:37:46 -0400
commitff540d029af1a5744fbf7c9b837801e46f683556 (patch)
tree38277a6c8b9dc547960b49ff85b688c484d3cac1 /drivers/ata
parent50f5a3415c2fc494e2bd80fc9e80cc62d64cbc3c (diff)
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: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/pata_imx.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/ata/pata_imx.c b/drivers/ata/pata_imx.c
index af893dda8528..f243496c3745 100644
--- a/drivers/ata/pata_imx.c
+++ b/drivers/ata/pata_imx.c
@@ -98,6 +98,7 @@ static int pata_imx_probe(struct platform_device *pdev)
98 struct pata_imx_priv *priv; 98 struct pata_imx_priv *priv;
99 int irq = 0; 99 int irq = 0;
100 struct resource *io_res; 100 struct resource *io_res;
101 int ret;
101 102
102 io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 103 io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
103 if (io_res == NULL) 104 if (io_res == NULL)
@@ -121,8 +122,10 @@ static int pata_imx_probe(struct platform_device *pdev)
121 clk_prepare_enable(priv->clk); 122 clk_prepare_enable(priv->clk);
122 123
123 host = ata_host_alloc(&pdev->dev, 1); 124 host = ata_host_alloc(&pdev->dev, 1);
124 if (!host) 125 if (!host) {
125 goto free_priv; 126 ret = -ENOMEM;
127 goto err;
128 }
126 129
127 host->private_data = priv; 130 host->private_data = priv;
128 ap = host->ports[0]; 131 ap = host->ports[0];
@@ -135,7 +138,8 @@ static int pata_imx_probe(struct platform_device *pdev)
135 resource_size(io_res)); 138 resource_size(io_res));
136 if (!priv->host_regs) { 139 if (!priv->host_regs) {
137 dev_err(&pdev->dev, "failed to map IO/CTL base\n"); 140 dev_err(&pdev->dev, "failed to map IO/CTL base\n");
138 goto free_priv; 141 ret = -EBUSY;
142 goto err;
139 } 143 }
140 144
141 ap->ioaddr.cmd_addr = priv->host_regs + PATA_IMX_DRIVE_DATA; 145 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 priv->host_regs + PATA_IMX_ATA_INT_EN); 162 priv->host_regs + PATA_IMX_ATA_INT_EN);
159 163
160 /* activate */ 164 /* activate */
161 return ata_host_activate(host, irq, ata_sff_interrupt, 0, 165 ret = ata_host_activate(host, irq, ata_sff_interrupt, 0,
162 &pata_imx_sht); 166 &pata_imx_sht);
163 167
164free_priv: 168 if (ret)
169 goto err;
170
171 return 0;
172err:
165 clk_disable_unprepare(priv->clk); 173 clk_disable_unprepare(priv->clk);
166 174
167 return -ENOMEM; 175 return ret;
168} 176}
169 177
170static int pata_imx_remove(struct platform_device *pdev) 178static int pata_imx_remove(struct platform_device *pdev)