From: sashiko-bot@kernel.org
To: "Janani Sunil" <janani.sunil@analog.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v5 3/3] iio: dac: Add AD5529R DAC driver support
Date: Wed, 01 Jul 2026 06:52:38 +0000 [thread overview]
Message-ID: <20260701065238.8DD671F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260701-ad5529r-driver-v5-3-ed087900e642@analog.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Channels not specified in the device tree are exposed to userspace but their hardware range is not explicitly configured.
--
commit eb86f7024ceca6fa634016d239f7ccfbf35f6a11
Author: Janani Sunil <janani.sunil@analog.com>
Date: Wed Jul 1 06:40:41 2026 +0000
iio: dac: Add AD5529R DAC driver support
This commit adds support for the Analog Devices AD5529R 16-channel, 12/16-bit
Digital to Analog Converter. The device communicates over SPI and supports
per-channel output range configuration.
> diff --git a/drivers/iio/dac/ad5529r.c b/drivers/iio/dac/ad5529r.c
> new file mode 100644
> --- /dev/null
> +++ b/drivers/iio/dac/ad5529r.c
[ ... ]
> +static int ad5529r_parse_channel_ranges(struct device *dev,
> + struct ad5529r_state *st)
> +{
> + s32 vals[2];
> + int ret, range_idx;
> + u32 ch;
> +
> + device_for_each_child_node_scoped(dev, child) {
> + ret = fwnode_property_read_u32(child, "reg", &ch);
> + if (ret)
[ ... ]
> + st->output_range_idx[ch] = range_idx;
> + ret = regmap_write(st->regmap_16bit,
> + AD5529R_REG_OUT_RANGE(ch), range_idx);
> + if (ret)
> + return dev_err_probe(dev, ret,
> + "Failed to configure range for ch %u\n",
> + ch);
> + }
> +
> + return 0;
> +}
[ ... ]
> +static int ad5529r_probe(struct spi_device *spi)
> +{
[ ... ]
> + ret = ad5529r_parse_channel_ranges(dev, st);
> + if (ret)
> + return ret;
> +
> + indio_dev->name = st->model_data->model_name;
> + indio_dev->info = &ad5529r_info;
> + indio_dev->modes = INDIO_DIRECT_MODE;
> + indio_dev->channels = st->model_data->channels;
> + indio_dev->num_channels = st->model_data->num_channels;
[Severity: High]
If a channel is omitted from the device tree during
ad5529r_parse_channel_ranges(), will it remain uninitialized in hardware
while still being unconditionally exposed to userspace here?
Since ad5529r_parse_channel_ranges() only configures the output range
registers for channels explicitly defined in the device tree child nodes,
unlisted channels will retain whatever state the hardware bootloader or reset
left them in.
The software state for these unlisted channels in st->output_range_idx
defaults to 0 (AD5529R_RANGE_0V_5V). Could this discrepancy cause unexpected
high-voltage outputs if userspace writes to these unconfigured hardware
channels?
> +
> + return devm_iio_device_register(dev, indio_dev);
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260701-ad5529r-driver-v5-0-ed087900e642@analog.com?part=3
next prev parent reply other threads:[~2026-07-01 6:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 6:40 [PATCH v5 0/3] iio: dac: Add support for AD5529R DAC Janani Sunil
2026-07-01 6:40 ` [PATCH v5 1/3] dt-bindings: spi: Add spi,device-addr peripheral property Janani Sunil
2026-07-01 6:52 ` sashiko-bot
2026-07-01 11:04 ` Conor Dooley
2026-07-01 18:29 ` Jonathan Cameron
2026-07-01 18:48 ` David Lechner
2026-07-01 20:31 ` Conor Dooley
2026-07-01 6:40 ` [PATCH v5 2/3] dt-bindings: iio: dac: Add AD5529R Janani Sunil
2026-07-01 6:52 ` sashiko-bot
2026-07-01 11:07 ` Conor Dooley
2026-07-01 18:41 ` Jonathan Cameron
2026-07-01 6:40 ` [PATCH v5 3/3] iio: dac: Add AD5529R DAC driver support Janani Sunil
2026-07-01 6:52 ` sashiko-bot [this message]
2026-07-01 9:17 ` Andy Shevchenko
2026-07-01 18:55 ` 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=20260701065238.8DD671F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=janani.sunil@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