Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Kim Seer Paller" <kimseer.paller@analog.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 3/3] iio: dac: ad5710r: Add driver for AD5710R and AD5711R
Date: Thu, 16 Jul 2026 08:12:28 +0000	[thread overview]
Message-ID: <20260716081229.079AF1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260716-iio-ad5710r-upstream-v1-3-e848a4bb701f@analog.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Potential NULL pointer dereference of `st->chip_info`.
- [Medium] The return value of reset_control_assert() is ignored, masking potential reset failures.
--

--- Patch [3]: [PATCH 3/3] iio: dac: ad5710r: Add driver for AD5710R and AD5711R ---
commit b76ab75f312950575e4dba88d63f7b40e599ffe4
Author: Kim Seer Paller <kimseer.paller@analog.com>

iio: dac: ad5710r: Add driver for AD5710R and AD5711R

This commit adds a new driver for the AD5710R and AD5711R DACs.
The devices are 8-channel, low-power, configurable current/voltage
output DACs.

> diff --git a/drivers/iio/dac/ad5710r.c b/drivers/iio/dac/ad5710r.c
> new file mode 100644
> index 0000000000000..05bdada0bb6eb
> --- /dev/null
> +++ b/drivers/iio/dac/ad5710r.c

[ ... ]

> +static int ad5710r_setup(struct ad5710r_state *st, int external_vref_uV, u8 *num_channels)
> +{

[ ... ]

> +	if (reset) {
> +		/* Hold RESET low; tRESET pulse width is 160 ns min (Table 4) */
> +		reset_control_assert(reset);

[Severity: Medium]
Could this reset assertion fail? The return value of reset_control_assert() is
ignored here, which might leave the device in an unknown state if the reset
controller (e.g., over I2C) returns an error.

> +		fsleep(1);
> +		ret = reset_control_deassert(reset);
> +		if (ret)
> +			return ret;
> +	} else {

[ ... ]

> +static int ad5710r_probe(struct spi_device *spi)
> +{

[ ... ]

> +	st->regmap = devm_regmap_init_spi(spi, &ad5710r_regmap_config);
> +	if (IS_ERR(st->regmap))
> +		return dev_err_probe(dev, PTR_ERR(st->regmap),
> +				     "Failed to init regmap\n");
> +
> +	st->chip_info = spi_get_device_match_data(spi);

[ ... ]

> +	ret = ad5710r_setup(st, external_vref_uV, &num_channels);
> +	if (ret)
> +		return ret;
> +
> +	indio_dev->name = st->chip_info->name;

[Severity: High]
Is it possible for st->chip_info to be NULL here? If the device is bound via
fallback mechanisms like writing to the driver_override sysfs attribute,
spi_get_device_match_data() might return NULL, leading to a NULL pointer
dereference when accessing st->chip_info->name.

> +	indio_dev->info = &ad5710r_info;
> +	indio_dev->modes = INDIO_DIRECT_MODE;
> +	indio_dev->channels = st->iio_channels;
> +	indio_dev->num_channels = num_channels;
> +
> +	return devm_iio_device_register(&spi->dev, indio_dev);
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260716-iio-ad5710r-upstream-v1-0-e848a4bb701f@analog.com?part=3

      reply	other threads:[~2026-07-16  8:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16  7:59 [PATCH 0/3] Add AD5710R/AD5711R DAC Kim Seer Paller
2026-07-16  7:59 ` [PATCH 1/3] iio: ABI: add DAC high_z powerdown mode and current output entries Kim Seer Paller
2026-07-16  7:59 ` [PATCH 2/3] dt-bindings: iio: dac: add adi,ad5710r.yaml Kim Seer Paller
2026-07-16  8:13   ` sashiko-bot
2026-07-16  7:59 ` [PATCH 3/3] iio: dac: ad5710r: Add driver for AD5710R and AD5711R Kim Seer Paller
2026-07-16  8:12   ` sashiko-bot [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=20260716081229.079AF1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=kimseer.paller@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