From: sashiko-bot@kernel.org
To: "Jan Carlo Roleda" <jancarlo.roleda@analog.com>
Cc: conor+dt@kernel.org, linux-leds@vger.kernel.org, lee@kernel.org,
robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v11 2/2] leds: ltc3208: Add driver for LTC3208 Multidisplay LED Driver
Date: Wed, 02 Sep 2026 23:56:02 +0000 [thread overview]
Message-ID: <20260902235602.8112F1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260903-upstream-ltc3208-v11-2-28f5f0fd364e@analog.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Incorrect assignment of num_reg_defaults using a register address macro instead of ARRAY_SIZE.
--
commit 13fa42bec99e4f9ce4669e4a6a7c6f12807ee3a4
Author: Jan Carlo Roleda <jancarlo.roleda@analog.com>
leds: ltc3208: Add driver for LTC3208 Multidisplay LED Driver
This commit introduces a new kernel driver for the Analog Devices LTC3208
Multi-display LED driver. It configures the device via I2C and supports up
to 7 distinct LED channels with configurable current levels.
> diff --git a/drivers/leds/leds-ltc3208.c b/drivers/leds/leds-ltc3208.c
> new file mode 100644
> --- /dev/null
> +++ b/drivers/leds/leds-ltc3208.c
[ ... ]
> +static const struct regmap_config ltc3208_regmap_cfg = {
> + .reg_bits = 8,
> + .val_bits = 8,
> + .max_register = LTC3208_REG_G_OPT,
> + .cache_type = REGCACHE_FLAT_S,
> + .reg_defaults = ltc3208_reg_defaults,
> + .num_reg_defaults = LTC3208_REG_G_OPT,
[Severity: Low]
Does this code intentionally use a register address macro for the array length
instead of ARRAY_SIZE(ltc3208_reg_defaults)?
Because LTC3208_REG_G_OPT happens to evaluate to 7, it coincidentally matches
the exact number of elements in the ltc3208_reg_defaults array. However,
using a register address macro to specify an array length creates a brittle
semantic dependency. If elements are removed from the array, or if a register
with a different address is added in the future, this will result in an
incorrect size being passed to the regmap core.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260903-upstream-ltc3208-v11-0-28f5f0fd364e@analog.com?part=2
prev parent reply other threads:[~2026-09-02 23:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 23:46 [PATCH v11 0/2] Add support for LTC3208 multi-display driver Jan Carlo Roleda
2026-09-02 23:46 ` [PATCH v11 1/2] dt-bindings: leds: Document LTC3208 Multidisplay LED Driver Jan Carlo Roleda
2026-09-02 23:51 ` sashiko-bot
2026-09-02 23:46 ` [PATCH v11 2/2] leds: ltc3208: Add driver for " Jan Carlo Roleda
2026-09-02 23:56 ` sashiko-bot [this message]
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=20260902235602.8112F1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jancarlo.roleda@analog.com \
--cc=lee@kernel.org \
--cc=linux-leds@vger.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