mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 14:04:27 -04:00
iio: resolver: ad2s1200: use dev_err_probe()
Use dev_err_probe() instead of dev_err() to simplify the error path and cleanly handle deferred probing. Signed-off-by: Vojtěch Krátký <vo.kratky@seznam.cz> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
This commit is contained in:
committed by
Jonathan Cameron
parent
298b0f9c0e
commit
a1c5ca7b80
@@ -143,18 +143,14 @@ static int ad2s1200_probe(struct spi_device *spi)
|
||||
st->sdev = spi;
|
||||
|
||||
st->sample = devm_gpiod_get(&spi->dev, "adi,sample", GPIOD_OUT_LOW);
|
||||
if (IS_ERR(st->sample)) {
|
||||
dev_err(&spi->dev, "Failed to claim SAMPLE gpio: err=%ld\n",
|
||||
PTR_ERR(st->sample));
|
||||
return PTR_ERR(st->sample);
|
||||
}
|
||||
if (IS_ERR(st->sample))
|
||||
return dev_err_probe(&spi->dev, PTR_ERR(st->sample),
|
||||
"Failed to claim SAMPLE gpio\n");
|
||||
|
||||
st->rdvel = devm_gpiod_get(&spi->dev, "adi,rdvel", GPIOD_OUT_LOW);
|
||||
if (IS_ERR(st->rdvel)) {
|
||||
dev_err(&spi->dev, "Failed to claim RDVEL gpio: err=%ld\n",
|
||||
PTR_ERR(st->rdvel));
|
||||
return PTR_ERR(st->rdvel);
|
||||
}
|
||||
if (IS_ERR(st->rdvel))
|
||||
return dev_err_probe(&spi->dev, PTR_ERR(st->rdvel),
|
||||
"Failed to claim RDVEL gpio\n");
|
||||
|
||||
indio_dev->info = &ad2s1200_info;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
Reference in New Issue
Block a user