[PATCH v2] iio: resolver: ad2s1200: use dev_err_probe()
From: Vojtěch Krátký
Date: Thu Jul 16 2026 - 13:04:18 EST
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@xxxxxxxxx>
---
Changes in v2:
- Removed curly brackets
- aligned the error message with the parenthesis
drivers/iio/resolver/ad2s1200.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/drivers/iio/resolver/ad2s1200.c b/drivers/iio/resolver/ad2s1200.c
index 55bcbbd4021a..2390822f8546 100644
--- a/drivers/iio/resolver/ad2s1200.c
+++ b/drivers/iio/resolver/ad2s1200.c
@@ -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;
--
2.55.0