From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Jonathan Cameron <jic23@kernel.org>
Cc: "Josef Bacik" <josef@toxicpanda.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
stable <stable@kernel.org>, "Nuno Sá" <nuno.sa@analog.com>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Renato Lui Geh" <renatogeh@gmail.com>,
"David Lechner" <dlechner@baylibre.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Ramona Bolboaca" <ramona.bolboaca@analog.com>,
"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Subject: [PATCH 05/15] iio: adc: check the result of ad_sd_init()
Date: Tue, 27 Oct 2026 17:19:09 +0100 [thread overview]
Message-ID: <20261027-llm-char-misc-iio-v1-5-0d818334f6c7@linuxfoundation.org> (raw)
In-Reply-To: <20261027-llm-char-misc-iio-v1-0-0d818334f6c7@linuxfoundation.org>
From: Josef Bacik <josef@toxicpanda.com>
ad_sd_init() asks for the optional "rdy" GPIO and returns the error if
that fails, for instance -EPROBE_DEFER. The binding of the AD7780
describes such a GPIO.
ad7780, ad7791, ad7793 and max11205 ignore the result. The function has
then returned before it set the driver data of the IIO device, which
devm_ad_sd_setup_buffer_and_trigger() dereferences a few lines further
down in these probe functions, and sigma_delta->rdy_gpiod holds an
ERR_PTR() which ad_sigma_delta_clear_pending_event() takes for a GPIO.
Return the error, as the other users of the library do.
Fixes: a87ef09b1fdf ("iio: adc: ad_sigma_delta: Add support for reading irq status using a GPIO")
Cc: stable <stable@kernel.org>
Cc: "Nuno Sá" <nuno.sa@analog.com>
Cc: Michael Hennerich <Michael.Hennerich@analog.com>
Cc: Renato Lui Geh <renatogeh@gmail.com>
Cc: David Lechner <dlechner@baylibre.com>
Cc: Andy Shevchenko <andy@kernel.org>
Cc: Ramona Bolboaca <ramona.bolboaca@analog.com>
Cc: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/iio/adc/ad7780.c | 4 +++-
drivers/iio/adc/ad7791.c | 4 +++-
drivers/iio/adc/ad7793.c | 4 +++-
drivers/iio/adc/max11205.c | 4 +++-
4 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/adc/ad7780.c b/drivers/iio/adc/ad7780.c
index 1cfad70320fe..c1428f30241c 100644
--- a/drivers/iio/adc/ad7780.c
+++ b/drivers/iio/adc/ad7780.c
@@ -311,7 +311,9 @@ static int ad7780_probe(struct spi_device *spi)
st = iio_priv(indio_dev);
st->gain = 1;
- ad_sd_init(&st->sd, indio_dev, spi, &ad7780_sigma_delta_info);
+ ret = ad_sd_init(&st->sd, indio_dev, spi, &ad7780_sigma_delta_info);
+ if (ret)
+ return ret;
st->chip_info =
&ad7780_chip_info_tbl[spi_get_device_id(spi)->driver_data];
diff --git a/drivers/iio/adc/ad7791.c b/drivers/iio/adc/ad7791.c
index c2688307bbba..10aa40ca35e7 100644
--- a/drivers/iio/adc/ad7791.c
+++ b/drivers/iio/adc/ad7791.c
@@ -435,7 +435,9 @@ static int ad7791_probe(struct spi_device *spi)
return ret;
st->info = &ad7791_chip_infos[spi_get_device_id(spi)->driver_data];
- ad_sd_init(&st->sd, indio_dev, spi, &ad7791_sigma_delta_info);
+ ret = ad_sd_init(&st->sd, indio_dev, spi, &ad7791_sigma_delta_info);
+ if (ret)
+ return ret;
indio_dev->name = spi_get_device_id(spi)->name;
indio_dev->modes = INDIO_DIRECT_MODE;
diff --git a/drivers/iio/adc/ad7793.c b/drivers/iio/adc/ad7793.c
index b0f44c144f20..937c8b09ad45 100644
--- a/drivers/iio/adc/ad7793.c
+++ b/drivers/iio/adc/ad7793.c
@@ -796,7 +796,9 @@ static int ad7793_probe(struct spi_device *spi)
st = iio_priv(indio_dev);
- ad_sd_init(&st->sd, indio_dev, spi, &ad7793_sigma_delta_info);
+ ret = ad_sd_init(&st->sd, indio_dev, spi, &ad7793_sigma_delta_info);
+ if (ret)
+ return ret;
if (pdata->refsel != AD7793_REFSEL_INTERNAL) {
ret = devm_regulator_get_enable_read_voltage(dev, "refin");
diff --git a/drivers/iio/adc/max11205.c b/drivers/iio/adc/max11205.c
index 53ac2f4f383e..e46e90400bdc 100644
--- a/drivers/iio/adc/max11205.c
+++ b/drivers/iio/adc/max11205.c
@@ -114,7 +114,9 @@ static int max11205_probe(struct spi_device *spi)
st = iio_priv(indio_dev);
- ad_sd_init(&st->sd, indio_dev, spi, &max11205_sigma_delta_info);
+ ret = ad_sd_init(&st->sd, indio_dev, spi, &max11205_sigma_delta_info);
+ if (ret)
+ return ret;
st->chip_info = spi_get_device_match_data(spi);
if (!st->chip_info)
--
2.56.0
next prev parent reply other threads:[~2026-10-27 16:19 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-27 16:19 [PATCH 00/15] IIO: a bunch of llm-found fixes Greg Kroah-Hartman
2026-10-27 16:19 ` [PATCH 01/15] iio: buffer: let the block keep its DMA fence Greg Kroah-Hartman
2026-10-28 9:30 ` Nuno Sá
2026-10-29 14:40 ` Nuno Sá
2026-10-29 15:43 ` Benoît Monin
2026-10-27 16:19 ` [PATCH 02/15] iio: trigger: fail the attach if no sub-IRQ is left Greg Kroah-Hartman
2026-10-28 9:38 ` Nuno Sá
2026-11-01 2:53 ` Jonathan Cameron
2026-10-27 16:19 ` [PATCH 03/15] iio: accel: adxl367: don't stay in standby on -EINVAL Greg Kroah-Hartman
2026-10-28 10:01 ` Nuno Sá
2026-10-27 16:19 ` [PATCH 04/15] iio: accel: adxl380: " Greg Kroah-Hartman
2026-10-28 10:02 ` Nuno Sá
2026-11-01 2:26 ` Jonathan Cameron
2026-10-27 16:19 ` Greg Kroah-Hartman [this message]
2026-10-28 9:40 ` [PATCH 05/15] iio: adc: check the result of ad_sd_init() Nuno Sá
2026-11-01 2:23 ` Jonathan Cameron
2026-10-27 16:19 ` [PATCH 06/15] iio: adc: ad7923: add the AD7927 to the SPI ID table Greg Kroah-Hartman
2026-10-28 9:35 ` Nuno Sá
2026-11-01 2:22 ` Jonathan Cameron
2026-10-27 16:19 ` [PATCH 07/15] iio: addac: ad74413r: fix the values of set_multiple Greg Kroah-Hartman
2026-10-28 9:38 ` Nuno Sá
2026-11-01 2:21 ` Jonathan Cameron
2026-10-27 16:19 ` [PATCH 08/15] iio: light: apds9306: push events to the IIO device Greg Kroah-Hartman
2026-11-01 2:20 ` Jonathan Cameron
2026-10-27 16:19 ` [PATCH 09/15] iio: light: tsl2591: don't divide by zero in the dark Greg Kroah-Hartman
2026-10-30 8:24 ` Joshua Crofts
2026-10-27 16:19 ` [PATCH 10/15] iio: light: tsl2591: don't divide by zero with low gain Greg Kroah-Hartman
2026-10-28 2:13 ` Jonathan Cameron
2026-10-28 4:16 ` Greg Kroah-Hartman
2026-10-27 16:19 ` [PATCH 11/15] iio: hid-sensors: fix a division by zero Greg Kroah-Hartman
2026-11-01 2:17 ` Jonathan Cameron
2026-10-27 16:19 ` [PATCH 12/15] iio: imu: inv_mpu6050: don't disable the IRQ under lock Greg Kroah-Hartman
2026-11-01 2:14 ` Jonathan Cameron
2026-10-27 16:19 ` [PATCH 13/15] iio: proximity: sx9500: hand on probe deferral of GPIOs Greg Kroah-Hartman
2026-10-28 2:09 ` Jonathan Cameron
2026-10-27 16:19 ` [PATCH 14/15] iio: scmi: use 64-bit divisions for rates and intervals Greg Kroah-Hartman
2026-10-28 1:46 ` Jonathan Cameron
2026-10-27 16:19 ` [PATCH 15/15] iio: sx9310: use the data of the I2C table Greg Kroah-Hartman
2026-10-27 16:25 ` Biju Das
2026-10-27 16:38 ` Andy Shevchenko
2026-11-01 2:11 ` Jonathan Cameron
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=20261027-llm-char-misc-iio-v1-5-0d818334f6c7@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=josef@toxicpanda.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=ramona.bolboaca@analog.com \
--cc=renatogeh@gmail.com \
--cc=stable@kernel.org \
--cc=u.kleine-koenig@baylibre.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®