Linux LED subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Peter LaDow" <pladow@gmail.com>
Cc: linux-leds@vger.kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org, lee@kernel.org
Subject: Re: [PATCH v4 3/3] leds: rgb: lp5860: Add I2C interface support
Date: Fri, 04 Dec 2026 00:46:42 +0000	[thread overview]
Message-ID: <sashiko-outbox-248846@kernel.org> (raw)
In-Reply-To: <20261203-add-i2c-support-for-lp5860-v4-3-dd84962336b1@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] leds: lp5860: lp5860_iterate_subleds() returns 0 on
  out-of-range channel
- [Low] leds: lp5860: undocumented core bounds-check fixes bundled in
  I2C commit
--

commit c30d7cd0ea8cc80600add2467fdd412378cb0465
Author: Peter LaDow <pladow@gmail.com>

> leds: rgb: lp5860: Add I2C interface support
>
> The Texas Instruments LP5860 RGB LED matrix driver supports both SPI and
> I2C communication buses depending on the IFS pin state, but the
> existing driver only implements the SPI bus interface.
>
> Add an I2C bus front-end driver (leds-lp5860-i2c) that reserves the
> four consecutive 7-bit I2C addresses used by the LP5860 to map its
> 10-bit register space across dummy I2C clients, initializes a custom
> regmap, and delegates device setup to lp5860_device_init(). Update
> Kconfig and Makefile so I2C and SPI support can be built independently
> or together.
>
> Tested on ZynqMP (ZU3) with an LP5860 connected over an AXI IIC at
> base address 0x40 (A1=0, A0=0) at 400 kHz.
>
> Signed-off-by: Peter LaDow <pladow@gmail.com>

[Severity: Low]
Should the off-by-one bounds-check fixes in leds-lp5860-core.c be split into
a separate commit, or at least described in the commit message?

The commit message only describes the new I2C driver, while the diff also
fixes off-by-one checks in lp5860_set_dot_onoff() and lp5860_iterate_subleds()
from f0a66563aa2d ("leds: Add support for TI LP5860 LED driver chip").
Splitting them out lets the SPI driver take the fix with a Fixes: tag.

[ ... ]

> diff --git a/drivers/leds/rgb/leds-lp5860-core.c b/drivers/leds/rgb/leds-lp5860-core.c
> index 84eb4635dafba..132ada3ea4b9f 100644
> --- a/drivers/leds/rgb/leds-lp5860-core.c
> +++ b/drivers/leds/rgb/leds-lp5860-core.c

[ ... ]

> @@ -115,7 +115,7 @@ static int lp5860_iterate_subleds(struct lp5860_led *led, struct led_init_data *
>  		}
>  
>  		ret = fwnode_property_read_u32(led_node, "reg", &channel);
> -		if (ret < 0 || channel > LP5860_MAX_LED) {
> +		if (ret < 0 || channel >= LP5860_MAX_LED) {
>  			dev_err_probe(led->chip->dev, ret,
>  				      "%pfwP: 'reg' property is missing. Skipping.\n", led_node);
>  			fwnode_handle_put(led_node);

[Severity: Medium]
Does lp5860_iterate_subleds() return 0 when channel >= LP5860_MAX_LED?

When fwnode_property_read_u32() succeeds with an out-of-range reg value such
as 198, ret is 0.  This branch logs error 0 via dev_err_probe() and returns
ret (0) instead of -EINVAL.

Because lp5860_init_dt() only skips the node on a non-zero return, it proceeds
to call lp5860_set_mc_brightness() with the remaining zero-initialized
subled_info entries (driving hardware channel 0) and registers a partially
initialized multicolor LED.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203-add-i2c-support-for-lp5860-v4-0-dd84962336b1@gmail.com?part=3

  reply	other threads:[~2026-12-04  0:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  0:34 [PATCH v4 0/3] leds: rgb: lp5860: Add I2C support Peter LaDow via B4 Relay
2026-12-04  0:34 ` [PATCH v4 1/3] dt-bindings: leds: ti,lp5860: Document I2C interface Peter LaDow via B4 Relay
2026-12-04  0:34 ` [PATCH v4 2/3] leds: rgb: lp5860: Consolidate common probe setup in lp5860_device_init() Peter LaDow via B4 Relay
2026-12-04  0:48   ` sashiko-bot
2026-12-04  0:34 ` [PATCH v4 3/3] leds: rgb: lp5860: Add I2C interface support Peter LaDow via B4 Relay
2026-12-04  0:46   ` sashiko-bot [this message]
2026-12-04  0:48 ` [PATCH v4 0/3] leds: rgb: lp5860: Add I2C support 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=sashiko-outbox-248846@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pladow@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