From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
To: Biren Pandya <birenpandya@gmail.com>
Cc: dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] iio: accel: kxsd9: use dev_err_probe()
Date: Mon, 20 Jul 2026 03:18:49 +0100 [thread overview]
Message-ID: <20260720031849.246d9276@jic23-huawei> (raw)
In-Reply-To: <20260714122520.3201-8-birenpandya@gmail.com>
On Tue, 14 Jul 2026 17:55:23 +0530
Biren Pandya <birenpandya@gmail.com> wrote:
> Modernize the error paths in kxsd9_common_probe() by using
Not sure we need the modernise bit of this.
> dev_err_probe() instead of dev_err() when handling failures from
> regulators and buffer setup.
>
> This simplifies the error handling and properly suppresses annoying
> and unnecessary log spam during -EPROBE_DEFER cases when regulators
> are not yet available during boot.
Not sure we need to state too much about it here, but it does
some more useful stuff than suppressing the log.
Take a look at debug stuff for deferred probing.
Anyhow, this one looks fine to me though the true benefit only
comes when these all become direct returns with a full move to devm
based cleanup.
Jonathan
>
> Signed-off-by: Biren Pandya <birenpandya@gmail.com>
> ---
> drivers/iio/accel/kxsd9.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c
> index 680d43135e617..ffbefd4576dd2 100644
> --- a/drivers/iio/accel/kxsd9.c
> +++ b/drivers/iio/accel/kxsd9.c
> @@ -433,10 +433,9 @@ int kxsd9_common_probe(struct device *dev,
> ret = devm_regulator_bulk_get(dev,
> ARRAY_SIZE(st->regs),
> st->regs);
> - if (ret) {
> - dev_err(dev, "Cannot get regulators\n");
> - return ret;
> - }
> + if (ret)
> + return dev_err_probe(dev, ret, "Cannot get regulators\n");
> +
> /* Default scaling */
> st->scale = KXSD9_CTRL_C_FS_2G;
>
> @@ -447,13 +446,15 @@ int kxsd9_common_probe(struct device *dev,
> kxsd9_trigger_handler,
> &kxsd9_buffer_setup_ops);
> if (ret) {
> - dev_err(dev, "triggered buffer setup failed\n");
> + dev_err_probe(dev, ret, "triggered buffer setup failed\n");
> goto err_power_down;
> }
>
> ret = iio_device_register(indio_dev);
> - if (ret)
> + if (ret) {
> + dev_err_probe(dev, ret, "device register failed\n");
> goto err_cleanup_buffer;
> + }
>
> dev_set_drvdata(dev, indio_dev);
>
prev parent reply other threads:[~2026-07-20 2:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260714122520.3201-5-birenpandya@gmail.com>
2026-07-14 12:25 ` [PATCH 1/3] iio: accel: kxsd9: validate input before acquiring runtime PM in write_raw runtime PM in write_raw Biren Pandya
2026-07-20 2:14 ` Jonathan Cameron
2026-07-14 12:25 ` [PATCH 2/3] iio: accel: kxsd9: modernize runtime PM in read_raw Biren Pandya
2026-07-20 2:15 ` Jonathan Cameron
2026-07-14 12:25 ` [PATCH 3/3] iio: accel: kxsd9: use dev_err_probe() Biren Pandya
2026-07-20 2:18 ` Jonathan Cameron [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=20260720031849.246d9276@jic23-huawei \
--to=jonathan.cameron@oss.qualcomm.com \
--cc=andy@kernel.org \
--cc=birenpandya@gmail.com \
--cc=dlechner@baylibre.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
/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