Skip to contentSkip to conversation

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

PATCH Applied Fabio Estevam 3 participants 3 messages Jul 10, 2013 – Jul 12, 2013

Subsystems (4)
lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

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

From: Fabio Estevam <[email protected]>

stmp_reset_block() may fail, so let's check its return value and propagate it in the case of error.

---
 drivers/staging/iio/adc/mxs-lradc.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/staging/iio/adc/mxs-lradc.c +9 -3
index d92c97a..327914e 100644
@@ -845,14 +845,16 @@ static const struct iio_chan_spec mxs_lradc_chan_spec[] = {
 	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. */
 	const uint32_t adc_cfg =
 		(1 << (LRADC_DELAY_TRIGGER_DELAYS_OFFSET + 0)) |
 		(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. */
 	writel(adc_cfg, lradc->base + LRADC_DELAY(0));
@@ -873,6 +875,8 @@ static void mxs_lradc_hw_init(struct mxs_lradc *lradc)
 
 	/* Start internal temperature sensing. */
 	writel(0, lradc->base + LRADC_CTRL2);
+
+	return 0;
 }
 
 static void mxs_lradc_hw_stop(struct mxs_lradc *lradc)
@@ -980,7 +984,9 @@ static int mxs_lradc_probe(struct platform_device *pdev)
 		goto err_trig;
 
 	/* Configure the hardware. */
-	mxs_lradc_hw_init(lradc);
+	ret = mxs_lradc_hw_init(lradc);
+	if (ret)
+		goto err_dev;
 
 	/* Register the touchscreen input device. */
 	ret = mxs_lradc_ts_register(lradc);
Signature · 1 line
1.8.1.2
maintainer Applied
#2 lore raw
Quoted 7 lines · Marek Vasut

Dear Fabio Estevam,

Quoted 5 lines

From: Fabio Estevam <[email protected]>

stmp_reset_block() may fail, so let's check its return value and propagate it in the case of error.

Quoted 6 lines
Quoted 4 lines
---
 drivers/staging/iio/adc/mxs-lradc.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Applied to the togreg branch of iio.git
Thanks,

Quoted 8 lines

Best regards,
Marek Vasut
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html