]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iio: adc: ti-ads124s08: Return reset GPIO lookup errors
authorPengpeng Hou <pengpeng@iscas.ac.cn>
Thu, 25 Jun 2026 05:44:07 +0000 (13:44 +0800)
committerJonathan Cameron <jic23@kernel.org>
Wed, 1 Jul 2026 21:35:21 +0000 (22:35 +0100)
devm_gpiod_get_optional() returns NULL when the optional GPIO is absent,
but returns an ERR_PTR when the GPIO provider lookup fails, including
probe deferral.

Probe currently logs the ERR_PTR case as if the reset GPIO were simply
absent and keeps the error pointer in reset_gpio. Later ads124s_reset()
treats any non-NULL reset_gpio as a valid descriptor and passes it to
gpiod_set_value_cansleep().

Return the lookup error instead of retaining the ERR_PTR.

Fixes: e717f8c6dfec ("iio: adc: Add the TI ads124s08 ADC code")
Cc: stable@vger.kernel.org
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/adc/ti-ads124s08.c

index 8ea1269f74db09427a4a8d434ba1d63e7c63d038..57eed8554bd926ef66764192d7fef3f4e91a651f 100644 (file)
@@ -321,7 +321,8 @@ static int ads124s_probe(struct spi_device *spi)
        ads124s_priv->reset_gpio = devm_gpiod_get_optional(&spi->dev,
                                                   "reset", GPIOD_OUT_LOW);
        if (IS_ERR(ads124s_priv->reset_gpio))
-               dev_info(&spi->dev, "Reset GPIO not defined\n");
+               return dev_err_probe(&spi->dev, PTR_ERR(ads124s_priv->reset_gpio),
+                                    "Failed to get reset GPIO\n");
 
        ads124s_priv->chip_info = &ads124s_chip_info_tbl[spi_id->driver_data];