Re: [PATCH v11 2/2] leds: ltc3208: Add driver for LTC3208 Multidisplay LED Driver
From: sashiko-bot@kernel.org
Date: 2026-09-02 23:56:03
Also in:
linux-leds
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 [off-list ref] 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.
quoted hunk ↗ jump to hunk
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