Commit 9ca39411 authored by Chuhong Yuan's avatar Chuhong Yuan Committed by Jonathan Cameron

iio: amplifiers: ad8366: Change devm_gpiod_get() to optional and add the missed check

Since if there is no GPIO, nothing happens, replace devm_gpiod_get()
with devm_gpiod_get_optional().
Also add IS_ERR() to fix the missing-check warning.

Fixes: cee211f4 ("iio: amplifiers: ad8366: Add support for the ADA4961 DGA")
Signed-off-by: default avatarChuhong Yuan <hslester96@gmail.com>
Acked-by: default avatarAlexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent df16c33a
...@@ -262,8 +262,11 @@ static int ad8366_probe(struct spi_device *spi) ...@@ -262,8 +262,11 @@ static int ad8366_probe(struct spi_device *spi)
case ID_ADA4961: case ID_ADA4961:
case ID_ADL5240: case ID_ADL5240:
case ID_HMC1119: case ID_HMC1119:
st->reset_gpio = devm_gpiod_get(&spi->dev, "reset", st->reset_gpio = devm_gpiod_get_optional(&spi->dev, "reset", GPIOD_OUT_HIGH);
GPIOD_OUT_HIGH); if (IS_ERR(st->reset_gpio)) {
ret = PTR_ERR(st->reset_gpio);
goto error_disable_reg;
}
indio_dev->channels = ada4961_channels; indio_dev->channels = ada4961_channels;
indio_dev->num_channels = ARRAY_SIZE(ada4961_channels); indio_dev->num_channels = ARRAY_SIZE(ada4961_channels);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment