mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] iio: resolver: ad2s1200: use dev_err_probe()
@ 2026-07-16 17:03 Vojtěch Krátký
  2026-07-16 18:20 ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Vojtěch Krátký @ 2026-07-16 17:03 UTC (permalink / raw)
  To: nuno.sa, Michael.Hennerich, jic23
  Cc: dlechner, andy, linux, linux-iio, linux-kernel, vo.kratky

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-18 22:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-16 17:03 [PATCH v2] iio: resolver: ad2s1200: use dev_err_probe() Vojtěch Krátký
2026-07-16 18:20 ` Andy Shevchenko
2026-07-18 22:50   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®