The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] iio: adc: ti-adc12138: fail init on calibration timeout
@ 2026-06-15 11:09 Prashant Rahul
  2026-06-15 12:12 ` John Ogness
  2026-06-15 13:54 ` Andy Shevchenko
  0 siblings, 2 replies; 4+ messages in thread
From: Prashant Rahul @ 2026-06-15 11:09 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio
  Cc: Shuah Khan, Prashant Rahul, David Lechner, Nuno Sá,
	Andy Shevchenko, Petr Mladek, Krzysztof Kozlowski, John Ogness,
	Oleg Nesterov, linux-kernel

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@gmail.com>
---
 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-06-16 10:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-15 11:09 [PATCH] iio: adc: ti-adc12138: fail init on calibration timeout Prashant Rahul
2026-06-15 12:12 ` John Ogness
2026-06-16 10:14   ` Prashant Rahul
2026-06-15 13:54 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox