All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Rodrigo Alencar" <rodrigo.alencar@analog.com>,
	devicetree@vger.kernel.org
Cc: robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 07/10] iio: frequency: ad9910: support drctl control
Date: Thu, 22 Oct 2026 15:42:18 +0000	[thread overview]
Message-ID: <sashiko-outbox-181715@kernel.org> (raw)
In-Reply-To: <20261022-ad9910-backend-support-v2-7-0ff7f0bff326@analog.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] iio: frequency: ad9910: ad9910_probe() fails when optional drctl PWM is absent
--

commit 5605b6a5e6a1ded9bd90cf8a046c13f843a2865d
Author: Rodrigo Alencar <rodrigo.alencar@analog.com>

iio: frequency: ad9910: support drctl control

This commit adds optional PWM control for the AD9910 digital ramp
generator DRCTL pin and exposes the integration_time attribute on the DRG
ramp up and ramp down channels using the PWM waveform API.

> diff --git a/drivers/iio/frequency/ad9910.c b/drivers/iio/frequency/ad9910.c
> index dc13986dff3db..1de02017f78c6 100644
> --- a/drivers/iio/frequency/ad9910.c
> +++ b/drivers/iio/frequency/ad9910.c

[ ... ]

> @@ -2249,6 +2365,21 @@ static int ad9910_probe(struct spi_device *spi)
>  
>  	fsleep(AD9910_WAKEUP_DELAY_us);
>  
> +	st->drctl_pwm = devm_pwm_get(dev, "drctl");
> +	if (IS_ERR(st->drctl_pwm)) {
> +		ret = PTR_ERR(st->drctl_pwm);
> +		if (ret != -ENOENT && ret != -ENODEV)
> +			return dev_err_probe(dev, PTR_ERR(st->drctl_pwm),
> +					     "failed to get drctl pwm\n");
> +		st->drctl_pwm = NULL;
> +	} else {

[Severity: High]
Will ad9910_probe() fail on Device Tree systems when the optional "drctl"
PWM is omitted from the device node?

On Device Tree platforms, the call chain is:

  ad9910_probe()
    -> devm_pwm_get(dev, "drctl")
      -> pwm_get(dev, "drctl")
        -> of_pwm_get(dev, np, "drctl")
          -> of_property_match_string(np, "pwm-names", "drctl")

Because a non-NULL con_id ("drctl") is passed, of_pwm_get() in
drivers/pwm/core.c resolves the name before looking up the "pwms"
property:

	if (con_id) {
		index = of_property_match_string(np, "pwm-names", con_id);
		if (index < 0)
			return ERR_PTR(index);
	}

In drivers/of/property.c, of_property_match_string() returns -EINVAL when
the "pwm-names" property is absent, or -ENODATA when the string is not
found:

	const struct property *prop = of_find_property(np, propname, NULL);
	...
	if (!prop)
		return -EINVAL;
	if (!prop->value)
		return -ENODATA;

Since ad9910_probe() only ignores -ENOENT and -ENODEV, won't
ERR_PTR(-EINVAL) or ERR_PTR(-ENODATA) cause probe to fail instead of
treating the "drctl" PWM as absent?

> +		ret = devm_add_action_or_reset(dev, ad9910_drctl_disable_action,
> +					       st->drctl_pwm);
> +		if (ret)
> +			return dev_err_probe(dev, ret,
> +					     "failed to add drctl disable action\n");
> +	}
> +
>  	ret = ad9910_parse_fw(st);
>  	if (ret)
>  		return ret;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261022-ad9910-backend-support-v2-0-0ff7f0bff326@analog.com?part=7

  reply	other threads:[~2026-10-22 15:42 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-22 15:18 [PATCH v2 00/10] iio: frequency: ad9910: add IIO backend support Rodrigo Alencar via B4 Relay
2026-10-22 15:18 ` Rodrigo Alencar
2026-10-22 15:18 ` [PATCH v2 01/10] iio: frequency: ad9910: powerdown fix Rodrigo Alencar via B4 Relay
2026-10-22 15:18   ` Rodrigo Alencar
2026-10-22 15:19 ` [PATCH v2 02/10] iio: backend: add devm_iio_backend_get_optional() Rodrigo Alencar via B4 Relay
2026-10-22 15:19   ` Rodrigo Alencar
2026-10-22 15:19 ` [PATCH v2 03/10] dt-bindings: iio: frequency: add adi,ad9910-axi-backend Rodrigo Alencar via B4 Relay
2026-10-22 15:19   ` Rodrigo Alencar
2026-10-22 18:38   ` Conor Dooley
2026-10-23 11:15     ` Rodrigo Alencar
2026-10-23 17:39       ` Conor Dooley
2026-10-22 15:19 ` [PATCH v2 04/10] dt-bindings: iio: frequency: ad9910: add io-backends property Rodrigo Alencar via B4 Relay
2026-10-22 15:19   ` Rodrigo Alencar
2026-10-22 15:19 ` [PATCH v2 05/10] iio: frequency: ad9910: move channel indexes into a shared header Rodrigo Alencar via B4 Relay
2026-10-22 15:19   ` Rodrigo Alencar
2026-10-22 15:19 ` [PATCH v2 06/10] iio: frequency: ad9910: add axi backend driver Rodrigo Alencar via B4 Relay
2026-10-22 15:19   ` Rodrigo Alencar
2026-10-26  0:29   ` Jonathan Cameron
2026-10-30 12:05   ` Nuno Sá
2026-10-22 15:19 ` [PATCH v2 07/10] iio: frequency: ad9910: support drctl control Rodrigo Alencar via B4 Relay
2026-10-22 15:19   ` Rodrigo Alencar
2026-10-22 15:42   ` sashiko-bot [this message]
2026-10-23 10:40   ` Rodrigo Alencar
2026-10-23 14:48     ` Nuno Sá
2026-10-22 15:19 ` [PATCH v2 08/10] iio: frequency: ad9910: support iio backend Rodrigo Alencar via B4 Relay
2026-10-22 15:19   ` Rodrigo Alencar
2026-10-30 12:05   ` Nuno Sá
2026-10-22 15:19 ` [PATCH v2 09/10] iio: ABI: add integration_time for output channels Rodrigo Alencar via B4 Relay
2026-10-22 15:19   ` Rodrigo Alencar
2026-10-22 15:19 ` [PATCH v2 10/10] docs: iio: ad9910: document DRCTL pin control Rodrigo Alencar via B4 Relay
2026-10-22 15:19   ` Rodrigo Alencar

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=sashiko-outbox-181715@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=rodrigo.alencar@analog.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.