From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: "Vojtěch Krátký" <vo.kratky@seznam.cz>
Cc: nuno.sa@analog.com, Michael.Hennerich@analog.com,
jic23@kernel.org, dlechner@baylibre.com, andy@kernel.org,
linux@analog.com, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: resolver: ad2s1200: use dev_err_probe()
Date: Thu, 16 Jul 2026 20:38:34 +0300 [thread overview]
Message-ID: <alkXGkOv2h9jTQ-5@ashevche-desk.local> (raw)
In-Reply-To: <20260716123100.100394-1-vo.kratky@seznam.cz>
On Thu, Jul 16, 2026 at 02:31:00PM +0200, Vojtěch Krátký wrote:
> Use dev_err_probe() instead of dev_err() to simplify the error path
> and cleanly handle deferred probing.
...
> 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);
> + return dev_err_probe(&spi->dev, PTR_ERR(st->sample),
> + "Failed to claim SAMPLE gpio\n");
> }
As Markus said, you can drop {}. On top of that you can introduce
struct device *dev = &spi->dev;
at the top of the function and make this all shorter.
if (IS_ERR(st->sample))
return dev_err_probe(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);
> + return dev_err_probe(&spi->dev, PTR_ERR(st->rdvel),
> + "Failed to claim RDVEL gpio\n");
> }
Ditto.
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2026-07-16 17:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 12:31 Vojtěch Krátký
2026-07-16 12:46 ` Markus Elfring
2026-07-16 12:51 ` Joshua Crofts
2026-07-16 17:38 ` Andy Shevchenko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alkXGkOv2h9jTQ-5@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@analog.com \
--cc=nuno.sa@analog.com \
--cc=vo.kratky@seznam.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®