Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Javier Carrasco" <javier.carrasco.cruz@gmail.com>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v8 3/4] iio: light: veml6031x00: add support for triggered buffers
Date: Tue, 01 Sep 2026 13:21:47 +0000	[thread overview]
Message-ID: <20260901132148.0D7BB1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260901-veml6031x00-v8-3-532cb4f2168a@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Spurious I2C hardware read of CONF0 register in trigger handler
--

commit bd3b6c2cea8a14ae14e9c9db625cc2c4fc898c75
Author: Javier Carrasco <javier.carrasco.cruz@gmail.com>

iio: light: veml6031x00: add support for triggered buffers

Add triggered buffer functionality for the two channels the device
provides (ALS and IR).

> diff --git a/drivers/iio/light/veml6031x00.c b/drivers/iio/light/veml6031x00.c
> index f3772577a05d5..3d5a27a0baaed 100644
> --- a/drivers/iio/light/veml6031x00.c
> +++ b/drivers/iio/light/veml6031x00.c
[ ... ]
> +static irqreturn_t veml6031x00_trig_handler(int irq, void *p)
> +{
> +	struct iio_poll_func *pf = p;
> +	struct iio_dev *iio = pf->indio_dev;
> +	struct veml6031x00_data *data = iio_priv(iio);
> +	struct regmap *map = data->regmap;
> +	IIO_DECLARE_BUFFER_WITH_TS(__le16, scan, 2) = { };
> +	unsigned int i;
> +	int ch, ret;
> +
> +	if (test_bit(VEML6031X00_SCAN_ALS, iio->active_scan_mask) &&
> +	    test_bit(VEML6031X00_SCAN_IR, iio->active_scan_mask)) {
> +		ret = regmap_bulk_read(map, VEML6031X00_REG_ALS_L,
> +				       scan, 2 * sizeof(*scan));
> +		if (ret)
> +			goto done;
> +	} else {
> +		i = 0;
> +		iio_for_each_active_channel(iio, ch) {
> +			ret = regmap_bulk_read(map, iio->channels[ch].address,
> +					       &scan[i++], sizeof(*scan));

[Severity: Medium]
Will this loop perform a spurious I2C hardware read of the CONF0 register?

When userspace enables the timestamp channel and only one of the data channels
(ALS or IR), the first if condition fails and the code falls back to this
else block.

iio_for_each_active_channel() iterates over all set bits in the scan mask,
including the timestamp channel. Since .address is implicitly 0 for the
timestamp channel, does this mean regmap_bulk_read() will read from address
0 (VEML6031X00_REG_CONF0) when processing the timestamp channel?

Should there be a check to skip the timestamp channel before reading from the
hardware, for example by checking if iio->channels[ch].type != IIO_TIMESTAMP?

> +			if (ret)
> +				goto done;
> +		}
> +	}
> +
> +	iio_push_to_buffers_with_ts(iio, scan, sizeof(scan), pf->timestamp);
> +
> +done:
> +	iio_trigger_notify_done(iio->trig);
> +
> +	return IRQ_HANDLED;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260901-veml6031x00-v8-0-532cb4f2168a@gmail.com?part=3

  reply	other threads:[~2026-09-01 13:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01 13:05 [PATCH v8 0/4] iio: light: add support for veml6031x00 ALS series Javier Carrasco
2026-09-01 13:05 ` [PATCH v8 1/4] dt-bindings: iio: light: veml6030: add " Javier Carrasco
2026-09-01 13:05 ` [PATCH v8 2/4] iio: light: add support for " Javier Carrasco
2026-09-01 13:05 ` [PATCH v8 3/4] iio: light: veml6031x00: add support for triggered buffers Javier Carrasco
2026-09-01 13:21   ` sashiko-bot [this message]
2026-09-01 13:05 ` [PATCH v8 4/4] iio: light: veml6031x00: add support for events and trigger Javier Carrasco
2026-09-01 13:22   ` 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=20260901132148.0D7BB1F000E9@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=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