From: Biren Pandya <birenpandya@gmail.com>
To: jic23@kernel.org, dlechner@baylibre.com, nuno.sa@analog.com,
andy@kernel.org, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Biren Pandya <birenpandya@gmail.com>
Subject: [PATCH 3/3] iio: accel: kxsd9: use dev_err_probe()
Date: Tue, 14 Jul 2026 17:55:23 +0530 [thread overview]
Message-ID: <20260714122520.3201-8-birenpandya@gmail.com> (raw)
In-Reply-To: <20260714122520.3201-5-birenpandya@gmail.com>
Modernize the error paths in kxsd9_common_probe() by using
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.
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);
--
2.50.1 (Apple Git-155)
next prev parent reply other threads:[~2026-07-14 12:25 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 ` Biren Pandya [this message]
2026-07-20 2:18 ` [PATCH 3/3] iio: accel: kxsd9: use dev_err_probe() Jonathan Cameron
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=20260714122520.3201-8-birenpandya@gmail.com \
--to=birenpandya@gmail.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=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