Devicetree
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: Jan Carlo Roleda <jancarlo.roleda@analog.com>,
	conor+dt@kernel.org, linux-leds@vger.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: Thu, 10 Sep 2026 16:51:12 +0100	[thread overview]
Message-ID: <20260910155112.GI1051768@google.com> (raw)
In-Reply-To: <20260902235602.8112F1F000E9@smtp.kernel.org>

On Wed, 02 Sep 2026, sashiko-bot@kernel.org wrote:

> 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.

Please review, explain or fix the Sashiko review(s).

If this is a set, this request includes the other patches too.

> --
> 
> 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
> 

-- 
Lee Jones

  reply	other threads:[~2026-09-10 15:51 UTC|newest]

Thread overview: 7+ 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
2026-09-10 15:51     ` Lee Jones [this message]
2026-09-10 22:51     ` Roleda, Jan carlo

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=20260910155112.GI1051768@google.com \
    --to=lee@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jancarlo.roleda@analog.com \
    --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