From: Arnav Kapoor <kapoorarnav43@gmail.com>
To: iasnezhkov@gmail.com
Cc: jic23@kernel.org, dlechner@baylibre.com, nuno.sa@analog.com,
andy@kernel.org, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: inkern: guard fwnode_xlate with info_exist_lock
Date: Thu, 26 Nov 2026 10:29:42 +0530 [thread overview]
Message-ID: <20261126045942.518691-1-kapoorarnav43@gmail.com> (raw)
In-Reply-To: <20261125234827.94791-1-iasnezhkov@gmail.com>
On Wed, Nov 25, 2026 at 11:48:27PM +0000, Ilia Snezhkov wrote:
> + scoped_guard(mutex, &iio_dev_opaque->info_exist_lock) {
> + if (!indio_dev->info)
> + index = -ENODEV;
Taking info_exist_lock here matches the rest of inkern.c, but -ENODEV
already means "no channel on this node, keep looking" in the callers.
Without a name, __fwnode_iio_channel_get_by_name() passes it back up,
fwnode_iio_channel_get_by_name() then walks the parents and
iio_channel_get() falls back to iio_channel_get_sys(), and
iio_channel_get_all() falls back to the map list on -ENODEV from
fwnode_iio_channel_get_all(). So if the race is hit, the lookup carries
on instead of failing. A code that isn't used as that sentinel would
avoid it.
> + if (index >= indio_dev->num_channels)
> + index = -EINVAL;
__fwnode_iio_simple_xlate() already checks args[0] against
num_channels, so this only matters for drivers with their own
fwnode_xlate. Could the commit message say that, or could it be a
separate patch? It is unrelated to the locking.
Thanks,
Arnav
next prev parent reply other threads:[~2026-11-26 4:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 23:48 Ilia Snezhkov via B4 Relay
2026-11-26 4:59 ` Arnav Kapoor [this message]
2026-11-26 9:19 ` Andy Shevchenko
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=20261126045942.518691-1-kapoorarnav43@gmail.com \
--to=kapoorarnav43@gmail.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=iasnezhkov@gmail.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
/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
all inboxes | Powered by JetHome®