Skip to content

Commit 030fb84

Browse files
neosys007gregkh
authored andcommitted
iio: adc: ti-ads124s08: Return reset GPIO lookup errors
commit 7dc4de2 upstream. 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: e717f8c ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f3f90bc commit 030fb84

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/iio/adc/ti-ads124s08.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,8 @@ static int ads124s_probe(struct spi_device *spi)
322322
ads124s_priv->reset_gpio = devm_gpiod_get_optional(&spi->dev,
323323
"reset", GPIOD_OUT_LOW);
324324
if (IS_ERR(ads124s_priv->reset_gpio))
325-
dev_info(&spi->dev, "Reset GPIO not defined\n");
325+
return dev_err_probe(&spi->dev, PTR_ERR(ads124s_priv->reset_gpio),
326+
"Failed to get reset GPIO\n");
326327

327328
ads124s_priv->chip_info = &ads124s_chip_info_tbl[spi_id->driver_data];
328329

0 commit comments

Comments
 (0)