Commit 947123d5 authored by Fabio Estevam's avatar Fabio Estevam Committed by Jonathan Cameron

iio: mxs-lradc: Check the return value from stmp_reset_block()

stmp_reset_block() may fail, so let's check its return value and propagate it in
the case of error.
Signed-off-by: default avatarFabio Estevam <fabio.estevam@freescale.com>
Acked-by: default avatarMarek Vasut <marex@denx.de>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 70ea35fb
...@@ -841,14 +841,16 @@ static const struct iio_chan_spec mxs_lradc_chan_spec[] = { ...@@ -841,14 +841,16 @@ static const struct iio_chan_spec mxs_lradc_chan_spec[] = {
MXS_ADC_CHAN(15, IIO_VOLTAGE), /* VDD5V */ MXS_ADC_CHAN(15, IIO_VOLTAGE), /* VDD5V */
}; };
static void mxs_lradc_hw_init(struct mxs_lradc *lradc) static int mxs_lradc_hw_init(struct mxs_lradc *lradc)
{ {
/* The ADC always uses DELAY CHANNEL 0. */ /* The ADC always uses DELAY CHANNEL 0. */
const uint32_t adc_cfg = const uint32_t adc_cfg =
(1 << (LRADC_DELAY_TRIGGER_DELAYS_OFFSET + 0)) | (1 << (LRADC_DELAY_TRIGGER_DELAYS_OFFSET + 0)) |
(LRADC_DELAY_TIMER_PER << LRADC_DELAY_DELAY_OFFSET); (LRADC_DELAY_TIMER_PER << LRADC_DELAY_DELAY_OFFSET);
stmp_reset_block(lradc->base); int ret = stmp_reset_block(lradc->base);
if (ret)
return ret;
/* Configure DELAY CHANNEL 0 for generic ADC sampling. */ /* Configure DELAY CHANNEL 0 for generic ADC sampling. */
writel(adc_cfg, lradc->base + LRADC_DELAY(0)); writel(adc_cfg, lradc->base + LRADC_DELAY(0));
...@@ -869,6 +871,8 @@ static void mxs_lradc_hw_init(struct mxs_lradc *lradc) ...@@ -869,6 +871,8 @@ static void mxs_lradc_hw_init(struct mxs_lradc *lradc)
/* Start internal temperature sensing. */ /* Start internal temperature sensing. */
writel(0, lradc->base + LRADC_CTRL2); writel(0, lradc->base + LRADC_CTRL2);
return 0;
} }
static void mxs_lradc_hw_stop(struct mxs_lradc *lradc) static void mxs_lradc_hw_stop(struct mxs_lradc *lradc)
...@@ -976,7 +980,9 @@ static int mxs_lradc_probe(struct platform_device *pdev) ...@@ -976,7 +980,9 @@ static int mxs_lradc_probe(struct platform_device *pdev)
goto err_trig; goto err_trig;
/* Configure the hardware. */ /* Configure the hardware. */
mxs_lradc_hw_init(lradc); ret = mxs_lradc_hw_init(lradc);
if (ret)
goto err_dev;
/* Register the touchscreen input device. */ /* Register the touchscreen input device. */
ret = mxs_lradc_ts_register(lradc); ret = mxs_lradc_ts_register(lradc);
......
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