From: sashiko-bot@kernel.org
To: "Chang Yu" <marcus.yu.56@gmail.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v4 2/2] iio: light: add AS7343 multi-spectral sensor driver
Date: Sat, 12 Sep 2026 01:50:55 +0000 [thread overview]
Message-ID: <20260912015055.7CE4B1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260912013912.51887-3-marcus.yu.56@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Hardware state leak on error path leaves REG_BANK set, potentially breaking subsequent probe attempts.
--
commit 72a91926280c648f27572174db691cdd7cd7fa33
Author: Chang Yu <marcus.yu.56@gmail.com>
iio: light: add AS7343 multi-spectral sensor driver
Add a driver for the AMS AS7343 14-channel multi-spectral sensor.
The driver exposes 12 spectral channels via sysfs and implements
runtime PM to stop measurements when suspended.
> diff --git a/drivers/iio/light/as7343.c b/drivers/iio/light/as7343.c
> new file mode 100644
> index 0000000000000..9ea6a44c35b92
> --- /dev/null
> +++ b/drivers/iio/light/as7343.c
[ ... ]
> +static int as7343_setup_device(struct device *dev, struct as7343_data *data)
> +{
> + struct regmap *map = data->regmap;
> + unsigned int val;
> + __le16 step;
> + int ret;
> +
> + /* Power on */
> + ret = regmap_set_bits(map, AS7343_ENABLE, AS7343_ENABLE_PON);
> + if (ret)
> + return ret;
> +
> + /* Need to set REG_BANK to 1 before we can access ID */
> + ret = regmap_set_bits(map, AS7343_CFG0, AS7343_CFG0_REG_BANK);
> + if (ret)
> + return ret;
> +
> + ret = regmap_read(map, AS7343_ID, &val);
> + if (ret)
> + return ret;
[Severity: Medium]
If regmap_read() fails here due to a transient I2C error, the function returns
early without clearing the AS7343_CFG0_REG_BANK bit.
Since the device is left in bank 1, and power might not be cut on probe
failure (for example, if the vdd regulator is shared or a dummy regulator),
could this cause subsequent probe attempts or deferred probes to fail because
the hardware is in an unexpected state?
> +
> + if (val != 0x81)
> + dev_info(dev, "Unknown device ID: %x\n", val);
> +
> + ret = regmap_clear_bits(map, AS7343_CFG0, AS7343_CFG0_REG_BANK);
> + if (ret)
> + return ret;
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260912013912.51887-1-marcus.yu.56@gmail.com?part=2
next prev parent reply other threads:[~2026-09-12 1:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-12 1:39 [PATCH v4 0/2] Add support for AS7343 multi-spectral sensor Chang Yu
2026-09-12 1:39 ` [PATCH v4 1/2] dt-bindings: iio: light: add as7343 Chang Yu
2026-09-13 0:56 ` Jonathan Cameron
2026-09-13 1:35 ` Chang Yu
2026-09-13 2:51 ` Jonathan Cameron
2026-09-13 3:20 ` Chang Yu
2026-09-13 17:14 ` Jonathan Cameron
2026-09-12 1:39 ` [PATCH v4 2/2] iio: light: add AS7343 multi-spectral sensor driver Chang Yu
2026-09-12 1:50 ` sashiko-bot [this message]
2026-09-13 2:47 ` Jonathan Cameron
2026-09-13 4:11 ` Chang Yu
2026-09-13 17:17 ` Jonathan Cameron
2026-09-13 0:30 ` [PATCH v4 0/2] Add support for AS7343 multi-spectral sensor Jonathan Cameron
2026-09-13 0:44 ` Chang Yu
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=20260912015055.7CE4B1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=marcus.yu.56@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