From: sashiko-bot@kernel.org
To: "Javier Carrasco" <javier.carrasco.cruz@gmail.com>
Cc: conor+dt@kernel.org, krzk+dt@kernel.org, robh@kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH v2 1/4] iio: light: veml6030: remove unnecessary read of IT index
Date: Thu, 14 May 2026 07:54:57 +0000 [thread overview]
Message-ID: <20260514075457.D6202C2BCB7@smtp.kernel.org> (raw)
In-Reply-To: <20260513-veml6031x00-v2-1-4703ca661a1d@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Setting the scale arbitrarily overwrites the user-configured integration time (ABI Violation).
- [High] Missing IIO direct mode locking creates severe race conditions.
--
commit 74466b38c7e17d127927fcfba05be4a756ae8325
Author: Javier Carrasco <javier.carrasco.cruz@gmail.com>
iio: light: veml6030: remove unnecessary read of IT index
This commit removes the read of the integration time index from
veml6030_set_scale(), as the value is read but not used afterward by gts
to set the new scale.
> diff --git a/drivers/iio/light/veml6030.c b/drivers/iio/light/veml6030.c
> index 6bcacae3863c0..745cf3ad7092e 100644
> --- a/drivers/iio/light/veml6030.c
> +++ b/drivers/iio/light/veml6030.c
> @@ -521,13 +521,9 @@ static int veml6030_write_persistence(struct iio_dev *indio_dev,
>
> static int veml6030_set_scale(struct iio_dev *indio_dev, int val, int val2)
> {
> - int ret, gain_sel, it_idx, it_sel;
> + int ret, gain_sel, it_sel;
> struct veml6030_data *data = iio_priv(indio_dev);
>
> - ret = regmap_field_read(data->rf.it, &it_idx);
> - if (ret)
> - return ret;
> -
Instead of removing the it_idx read, should the driver use it with
iio_gts_find_gain_sel_for_scale_using_time() to attempt to preserve the
current integration time?
Currently, iio_gts_find_gain_time_sel_for_scale() ignores the current
integration time and picks the first matching combination from the gts table.
This clobbers the sensor's current integration time, which might have been
explicitly set by the user for 50Hz/60Hz noise rejection.
> ret = iio_gts_find_gain_time_sel_for_scale(&data->gts, val, val2,
> &gain_sel, &it_sel);
> if (ret)
Is state locking and a call to iio_device_claim_direct() missing here?
Since the driver supports a triggered buffer, omitting this allows userspace
to concurrently change hardware configuration parameters mid-capture, which
can corrupt the buffered data stream.
Furthermore, this function performs independent regmap_field_write()
operations for the gain and integration time.
Without driver-level serialization, concurrent sysfs writes can interleave,
leaving the device configured with a mismatched, invalid gain and integration
time pair.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260513-veml6031x00-v2-0-4703ca661a1d@gmail.com?part=1
next prev parent reply other threads:[~2026-05-14 7:54 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 4:49 [PATCH v2 0/4] iio: light: add support for veml6031x00 ALS series Javier Carrasco
2026-05-13 4:49 ` [PATCH v2 1/4] iio: light: veml6030: remove unnecessary read of IT index Javier Carrasco
2026-05-13 16:59 ` Andy Shevchenko
2026-05-13 18:17 ` Javier Carrasco
2026-05-13 19:58 ` Andy Shevchenko
2026-05-14 7:54 ` sashiko-bot [this message]
2026-05-13 4:49 ` [PATCH v2 2/4] iio: light: veml6030: fix channel type when pushing events Javier Carrasco
2026-05-13 17:48 ` Andy Shevchenko
2026-05-13 18:13 ` Javier Carrasco
2026-05-13 20:02 ` Andy Shevchenko
2026-05-13 20:44 ` Javier Carrasco
2026-05-13 20:56 ` Andy Shevchenko
2026-05-14 8:08 ` sashiko-bot
2026-05-13 4:49 ` [PATCH v2 3/4] dt-bindings: iio: light: veml6030: add veml6031x00 ALS series Javier Carrasco
2026-05-13 4:49 ` [PATCH v2 4/4] iio: light: add support for " Javier Carrasco
[not found] ` <690B63AD-4429-4045-B413-29911ED7DA3D@gmail.com>
2026-05-13 16:36 ` Andy Shevchenko
2026-05-13 16:37 ` Andy Shevchenko
2026-05-13 16:56 ` Andy Shevchenko
2026-05-13 18:23 ` Javier Carrasco
2026-05-13 20:08 ` Andy Shevchenko
2026-05-14 9:29 ` sashiko-bot
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=20260514075457.D6202C2BCB7@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=javier.carrasco.cruz@gmail.com \
--cc=krzk+dt@kernel.org \
--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