aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@freescale.com>2014-10-04 07:50:21 -0400
committerJonathan Cameron <jic23@kernel.org>2014-11-05 13:33:44 -0500
commit4748119f1889b4ce96c84831ad0581598081b46f (patch)
tree84fe13a1b9ae136ff18bdeffa65ded9f2c3d18a8 /drivers/staging
parentc6b4cac2d9cbe7891260b55b2871d269d89d1ae7 (diff)
iio: adc: mxs-lradc: Disable the clock on probe failure
We should disable lradc->clk in the case of errors in the probe function. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Reviewed-by: Marek Vasut <marex@denx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org> Cc: <Stable@vger.kernel.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/iio/adc/mxs-lradc.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index 32a19264a170..2a29b9baec0d 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -1559,14 +1559,16 @@ static int mxs_lradc_probe(struct platform_device *pdev)
1559 /* Grab all IRQ sources */ 1559 /* Grab all IRQ sources */
1560 for (i = 0; i < of_cfg->irq_count; i++) { 1560 for (i = 0; i < of_cfg->irq_count; i++) {
1561 lradc->irq[i] = platform_get_irq(pdev, i); 1561 lradc->irq[i] = platform_get_irq(pdev, i);
1562 if (lradc->irq[i] < 0) 1562 if (lradc->irq[i] < 0) {
1563 return lradc->irq[i]; 1563 ret = lradc->irq[i];
1564 goto err_clk;
1565 }
1564 1566
1565 ret = devm_request_irq(dev, lradc->irq[i], 1567 ret = devm_request_irq(dev, lradc->irq[i],
1566 mxs_lradc_handle_irq, 0, 1568 mxs_lradc_handle_irq, 0,
1567 of_cfg->irq_name[i], iio); 1569 of_cfg->irq_name[i], iio);
1568 if (ret) 1570 if (ret)
1569 return ret; 1571 goto err_clk;
1570 } 1572 }
1571 1573
1572 lradc->vref_mv = of_cfg->vref_mv; 1574 lradc->vref_mv = of_cfg->vref_mv;
@@ -1588,7 +1590,7 @@ static int mxs_lradc_probe(struct platform_device *pdev)
1588 &mxs_lradc_trigger_handler, 1590 &mxs_lradc_trigger_handler,
1589 &mxs_lradc_buffer_ops); 1591 &mxs_lradc_buffer_ops);
1590 if (ret) 1592 if (ret)
1591 return ret; 1593 goto err_clk;
1592 1594
1593 ret = mxs_lradc_trigger_init(iio); 1595 ret = mxs_lradc_trigger_init(iio);
1594 if (ret) 1596 if (ret)
@@ -1643,6 +1645,8 @@ err_dev:
1643 mxs_lradc_trigger_remove(iio); 1645 mxs_lradc_trigger_remove(iio);
1644err_trig: 1646err_trig:
1645 iio_triggered_buffer_cleanup(iio); 1647 iio_triggered_buffer_cleanup(iio);
1648err_clk:
1649 clk_disable_unprepare(lradc->clk);
1646 return ret; 1650 return ret;
1647} 1651}
1648 1652