From: Prashant Rahul <prashantrahul23@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>, linux-iio@vger.kernel.org
Cc: "Shuah Khan" <shuahkhan@gmail.com>,
"Prashant Rahul" <prashantrahul23@gmail.com>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Petr Mladek" <pmladek@suse.com>,
"Krzysztof Kozlowski" <krzk@kernel.org>,
"John Ogness" <john.ogness@linutronix.de>,
"Oleg Nesterov" <oleg@redhat.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] iio: adc: ti-adc12138: fail init on calibration timeout
Date: Mon, 15 Jun 2026 16:39:13 +0530 [thread overview]
Message-ID: <20260615111156.199906-1-prashantrahul23@gmail.com> (raw)
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
next reply other threads:[~2026-06-15 11:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-15 11:09 Prashant Rahul [this message]
2026-06-15 12:12 ` [PATCH] iio: adc: ti-adc12138: fail init on calibration timeout John Ogness
2026-06-16 10:14 ` Prashant Rahul
2026-06-15 13:54 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260615111156.199906-1-prashantrahul23@gmail.com \
--to=prashantrahul23@gmail.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=john.ogness@linutronix.de \
--cc=krzk@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=oleg@redhat.com \
--cc=pmladek@suse.com \
--cc=shuahkhan@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.