drivers/iio/resolver/ad2s1200.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
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>
---
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
On Thu, Jul 16, 2026 at 07:03:06PM +0200, Vojtěch Krátký wrote: > Use dev_err_probe() instead of dev_err() to simplify the error path > and cleanly handle deferred probing. Wait at least 24h before sending a new version. Please, read the comments I gave against v1. ... No need to send a v3, now it's a good time to read comments, discuss, take other opinions. For example, if Jonathan is okay with v2, it maybe good to go. -- With Best Regards, Andy Shevchenko
On Thu, 16 Jul 2026 21:20:23 +0300 Andy Shevchenko <andriy.shevchenko@intel.com> wrote: > On Thu, Jul 16, 2026 at 07:03:06PM +0200, Vojtěch Krátký wrote: > > Use dev_err_probe() instead of dev_err() to simplify the error path > > and cleanly handle deferred probing. > > Wait at least 24h before sending a new version. Please, read the comments > I gave against v1. > > ... > > No need to send a v3, now it's a good time to read comments, discuss, take > other opinions. For example, if Jonathan is okay with v2, it maybe good to > go. I think Andy's suggestion was a good one, but given it would involve a couple of patches to add it and convert other places it can be used, probably followed by an update of this patch, I'm going to take this now and suggest anyone who is interested can revisit Andy's comments. >
© 2016 - 2026 Red Hat, Inc.