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 v3 02/10] iio: backend: add devm_iio_backend_get_optional()
Date: Tue, 03 Nov 2026 15:06:20 +0000	[thread overview]
Message-ID: <sashiko-outbox-195553@kernel.org> (raw)
In-Reply-To: <20261103-ad9910-backend-support-v3-2-0e9224ddf7b7@analog.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] iio: backend: wrong fwnode used in __devm_iio_backend_fwnode_get()
--

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

iio: backend: add devm_iio_backend_get_optional()

This commit introduces devm_iio_backend_get_optional() to return NULL when
an IIO backend is not described in firmware. It also updates
__devm_iio_backend_fwnode_get() and __devm_iio_backend_fwnode_get_by_index()
so that missing io-backends or io-backend-names entries consistently return
-ENOENT without logging an error.

> diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-backend.c
> index fbf5c39d76551..d12d163f45cad 100644
> --- a/drivers/iio/industrialio-backend.c
> +++ b/drivers/iio/industrialio-backend.c

[ ... ]

> @@ -1034,7 +1037,17 @@ static struct iio_backend *__devm_iio_backend_fwnode_get(struct device *dev, con
>  	int ret;
>  
>  	if (name) {
> +		if (!device_property_present(dev, "io-backend-names"))
> +			return ERR_PTR(-ENOENT);
> +
>  		ret = device_property_match_string(dev, "io-backend-names", name);

[Severity: Medium]
Should this check fwnode_property_present(fwnode, "io-backend-names")
(and fwnode_property_match_string(fwnode, "io-backend-names", name))
instead of querying dev?

__devm_iio_backend_fwnode_get() is also called by
devm_iio_backend_fwnode_get(), where a caller passes an explicit consumer
fwnode distinct from dev_fwnode(dev) (such as a child channel node):

devm_iio_backend_fwnode_get(dev, name, fwnode)
  __devm_iio_backend_fwnode_get(dev, name, fwnode)
    __devm_iio_backend_fwnode_get_by_index(dev, fwnode, index)
      fwnode_find_reference(fwnode, "io-backends", index)

When name is non-NULL and fwnode != dev_fwnode(dev), checking
device_property_present(dev, "io-backend-names") looks for the property on
dev rather than on fwnode, causing the lookup to fail with -ENOENT when
io-backend-names lives on the child fwnode or resolving the index from the
wrong node.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261103-ad9910-backend-support-v3-0-0e9224ddf7b7@analog.com?part=2

  reply	other threads:[~2026-11-03 15:06 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 14:52 [PATCH v3 00/10] iio: frequency: ad9910: add IIO backend support Rodrigo Alencar via B4 Relay
2026-11-03 14:52 ` Rodrigo Alencar
2026-11-03 14:52 ` [PATCH v3 01/10] iio: frequency: ad9910: powerdown fix Rodrigo Alencar via B4 Relay
2026-11-03 14:52   ` Rodrigo Alencar
2026-11-04  0:20   ` Jonathan Cameron
2026-11-04  8:54     ` Rodrigo Alencar
2026-11-03 14:52 ` [PATCH v3 02/10] iio: backend: add devm_iio_backend_get_optional() Rodrigo Alencar via B4 Relay
2026-11-03 14:52   ` Rodrigo Alencar
2026-11-03 15:06   ` sashiko-bot [this message]
2026-11-03 14:52 ` [PATCH v3 03/10] dt-bindings: iio: frequency: add adi,ad9910-axi-backend Rodrigo Alencar via B4 Relay
2026-11-03 14:52   ` Rodrigo Alencar
2026-11-03 14:53 ` [PATCH v3 04/10] dt-bindings: iio: frequency: ad9910: add io-backends property Rodrigo Alencar via B4 Relay
2026-11-03 14:53   ` Rodrigo Alencar
2026-11-03 14:53 ` [PATCH v3 05/10] iio: frequency: ad9910: move channel indexes into a shared header Rodrigo Alencar via B4 Relay
2026-11-03 14:53   ` Rodrigo Alencar
2026-11-03 14:53 ` [PATCH v3 06/10] iio: frequency: ad9910: add axi backend driver Rodrigo Alencar via B4 Relay
2026-11-03 14:53   ` Rodrigo Alencar
2026-11-04  0:09   ` Jonathan Cameron
2026-11-03 14:53 ` [PATCH v3 07/10] iio: frequency: ad9910: support drctl control Rodrigo Alencar via B4 Relay
2026-11-03 14:53   ` Rodrigo Alencar
2026-11-03 16:47   ` Andy Shevchenko
2026-11-04  0:15   ` Jonathan Cameron
2026-11-03 14:53 ` [PATCH v3 08/10] iio: frequency: ad9910: support iio backend Rodrigo Alencar via B4 Relay
2026-11-03 14:53   ` Rodrigo Alencar
2026-11-03 16:52   ` Andy Shevchenko
2026-11-03 14:53 ` [PATCH v3 09/10] iio: ABI: add integration_time for output channels Rodrigo Alencar via B4 Relay
2026-11-03 14:53   ` Rodrigo Alencar
2026-11-03 14:53 ` [PATCH v3 10/10] docs: iio: ad9910: document DRCTL pin control Rodrigo Alencar via B4 Relay
2026-11-03 14:53   ` 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-195553@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.