[PATCH] iio: adc: ti-adc12138: fail init on calibration timeout

From: Prashant Rahul

Date: Mon Jun 15 2026 - 07:14:04 EST


adc12138_init() starts device calibration and waits for the EOC
interrupt before checking the calibration status. The wait helper
returns -ETIMEDOUT if the interrupt does not arrive in time, but the
init path ignores the error and continues probing the device. This could
lead to registering the device even tho it may not be properly
initialized.

Return the wait error so probe fails cleanly when calibration does not
complete.

Signed-off-by: Prashant Rahul <prashantrahul23@xxxxxxxxx>
---
drivers/iio/adc/ti-adc12138.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ti-adc12138.c b/drivers/iio/adc/ti-adc12138.c
index e5ec4b073daa..1f5f4b7794c1 100644
--- a/drivers/iio/adc/ti-adc12138.c
+++ b/drivers/iio/adc/ti-adc12138.c
@@ -300,7 +300,11 @@ static int adc12138_init(struct adc12138 *adc)
if (status < 0)
return status;

- adc12138_wait_eoc(adc, msecs_to_jiffies(100));
+ ret = adc12138_wait_eoc(adc, msecs_to_jiffies(100));
+ if (ret) {
+ dev_warn(&adc->spi->dev, "wait eoc timeout\n");
+ return ret;
+ }

status = adc12138_read_status(adc);
if (status & ADC12138_STATUS_CAL) {
--
2.54.0