From: sashiko-bot@kernel.org
To: "Liviu Stan" <liviu.stan@analog.com>
Cc: devicetree@vger.kernel.org, krzk+dt@kernel.org, robh@kernel.org,
conor+dt@kernel.org
Subject: Re: [PATCH v2 4/7] iio: temperature: ltc2983: Use fwnode_property_present() for optional properties
Date: Thu, 14 May 2026 20:04:27 +0000 [thread overview]
Message-ID: <20260514200428.680FFC2BCB3@smtp.kernel.org> (raw)
In-Reply-To: <20260514144712.64374-5-liviu.stan@analog.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Bypassed software validation for RTD rotation when `adi,number-of-wires` is absent.
- [Medium] The commit only partially implements its stated goal, leaving multiple instances of the exact same error-swallowing anti-pattern throughout the driver.
--
commit 94ec4e6144c071e0f0444b0ad792dffbdf874d09
Author: Liviu Stan <liviu.stan@analog.com>
iio: temperature: ltc2983: Use fwnode_property_present() for optional properties
This commit attempts to fix the silent swallowing of error codes when optional
properties are present but malformed. It updates the property reads for
adi,sensor-oc-current-microamp and adi,number-of-wires to check for presence
first.
> Checking fwnode_property_read_u32() return value with if (!ret)
> silently swallows meaningful error codes when a property is present
> but malformed. Use fwnode_property_present() first so that absence
> uses the default while a present but unreadable property returns
> a proper error.
Does this commit miss updating other optional properties that share the same
error-swallowing pattern?
For example, in ltc2983_rtd_new(), adi,excitation-current-microamp still
falls back to default values on any error:
ret = fwnode_property_read_u32(child, "adi,excitation-current-microamp",
&excitation_current);
if (ret) {
/* default to 5uA */
rtd->excitation_current = 1;
Are there other instances, like in ltc2983_diode_new(), that also need this
update to fully implement the stated goal?
> --- a/drivers/iio/temperature/ltc2983.c
> +++ b/drivers/iio/temperature/ltc2983.c
[ ... ]
> @@ -760,8 +766,12 @@ ltc2983_rtd_new(const struct fwnode_handle *child, struct ltc2983_data *st,
> return dev_err_ptr_probe(dev, ret,
> "Property reg must be given\n");
>
> - ret = fwnode_property_read_u32(child, "adi,number-of-wires", &n_wires);
> - if (!ret) {
> + if (fwnode_property_present(child, "adi,number-of-wires")) {
> + ret = fwnode_property_read_u32(child, "adi,number-of-wires", &n_wires);
> + if (ret)
> + return dev_err_ptr_probe(dev, ret,
> + "Failed to read adi,number-of-wires\n");
> +
> switch (n_wires) {
> case 2:
> rtd->sensor_config = LTC2983_RTD_N_WIRES(0);
If the adi,number-of-wires property is absent, n_wires remains 0. Since
the hardware configuration correctly defaults to a 2-wire setup
(sensor_config is zero-initialized), does leaving n_wires as 0 introduce a
regression where it bypasses the later validation for RTD rotation?
Further down in ltc2983_rtd_new():
if (fwnode_property_read_bool(child, "adi,rsense-share")) {
/* Current rotation is only available with rsense sharing */
if (fwnode_property_read_bool(child, "adi,current-rotate")) {
if (n_wires == 2 || n_wires == 3)
return dev_err_ptr_probe(dev, -EINVAL,
"Rotation not allowed for 2/3 Wire RTDs\n");
If n_wires is 0, this check is bypassed and current rotation is allowed for
a 2-wire RTD configuration. Should n_wires be explicitly set to 2 when the
property is absent to enforce this hardware constraint?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260514144712.64374-1-liviu.stan@analog.com?part=4
next prev parent reply other threads:[~2026-05-14 20:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-14 14:46 [PATCH v2 0/7] iio: temperature: ltc2983: Add support for ADT7604 Liviu Stan
2026-05-14 14:46 ` [PATCH v2 1/7] iio: temperature: ltc2983: Fix macro parenthesization and rename Liviu Stan
2026-05-14 19:32 ` sashiko-bot
2026-05-14 14:46 ` [PATCH v2 2/7] iio: temperature: ltc2983: Use local device pointer consistently Liviu Stan
2026-05-14 19:39 ` sashiko-bot
2026-05-14 14:46 ` [PATCH v2 3/7] iio: temperature: ltc2983: Fix inconsistent channel wording in messages Liviu Stan
2026-05-14 19:47 ` sashiko-bot
2026-05-14 14:46 ` [PATCH v2 4/7] iio: temperature: ltc2983: Use fwnode_property_present() for optional properties Liviu Stan
2026-05-14 20:04 ` sashiko-bot [this message]
2026-05-14 14:46 ` [PATCH v2 5/7] iio: core: Add IIO_COVERAGE_PERCENT channel type Liviu Stan
2026-05-14 20:16 ` sashiko-bot
2026-05-14 14:46 ` [PATCH v2 6/7] dt-bindings: iio: temperature: Add ADT7604 support to adi,ltc2983 Liviu Stan
2026-05-14 20:43 ` sashiko-bot
2026-05-14 14:46 ` [PATCH v2 7/7] iio: temperature: ltc2983: Add support for ADT7604 Liviu Stan
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=20260514200428.680FFC2BCB3@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=liviu.stan@analog.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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