Skip to content

Commit

Permalink
iio: adc: mxs-lradc: Disable the clock on probe failure
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Fabio Estevam authored and Jonathan Cameron committed Oct 9, 2014
1 parent 4250c90 commit 75d7ed3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions drivers/staging/iio/adc/mxs-lradc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1565,14 +1565,16 @@ static int mxs_lradc_probe(struct platform_device *pdev)
/* Grab all IRQ sources */
for (i = 0; i < of_cfg->irq_count; i++) {
lradc->irq[i] = platform_get_irq(pdev, i);
if (lradc->irq[i] < 0)
return lradc->irq[i];
if (lradc->irq[i] < 0) {
ret = lradc->irq[i];
goto err_clk;
}

ret = devm_request_irq(dev, lradc->irq[i],
mxs_lradc_handle_irq, 0,
of_cfg->irq_name[i], iio);
if (ret)
return ret;
goto err_clk;
}

lradc->vref_mv = of_cfg->vref_mv;
Expand All @@ -1594,7 +1596,7 @@ static int mxs_lradc_probe(struct platform_device *pdev)
&mxs_lradc_trigger_handler,
&mxs_lradc_buffer_ops);
if (ret)
return ret;
goto err_clk;

ret = mxs_lradc_trigger_init(iio);
if (ret)
Expand Down Expand Up @@ -1649,6 +1651,8 @@ static int mxs_lradc_probe(struct platform_device *pdev)
mxs_lradc_trigger_remove(iio);
err_trig:
iio_triggered_buffer_cleanup(iio);
err_clk:
clk_disable_unprepare(lradc->clk);
return ret;
}

Expand Down

0 comments on commit 75d7ed3

Please sign in to comment.