From: sashiko-bot@kernel.org
To: "Loic Poulain" <loic.poulain@oss.qualcomm.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org,
linux-leds@vger.kernel.org, conor+dt@kernel.org, lee@kernel.org
Subject: Re: [PATCH v5 3/4] leds: pca963x: add multicolor LED class support
Date: Fri, 10 Jul 2026 14:10:48 +0000 [thread overview]
Message-ID: <20260710141048.8A4801F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260710-monza-leds-v5-3-a8972d28c28f@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] State desynchronization on I2C failure leaves the chip stuck in sleep mode.
--
--- Patch [3]: [PATCH v5 3/4] leds: pca963x: add multicolor LED class support ---
commit 8c03d358e0d33360e4842037176019ecbef4c7b9
Author: Loic Poulain <loic.poulain@oss.qualcomm.com>
leds: pca963x: add multicolor LED class support
Allow grouping of individual PCA963x PWM channels into a single
multicolor LED device by adding support for the LED multicolor class.
A child node with sub-children is treated as a multicolor group,
others are treated as single leds, keeping full backwards compatibility.
> diff --git a/drivers/leds/leds-pca963x.c b/drivers/leds/leds-pca963x.c
> index e3a81c60ee27c..e54a60c7bf282 100644
> --- a/drivers/leds/leds-pca963x.c
> +++ b/drivers/leds/leds-pca963x.c
[ ... ]
> @@ -221,22 +229,52 @@ static int pca963x_led_set(struct led_classdev *led_cdev,
[ ... ]
> +static int pca963x_led_mc_set(struct led_classdev *led_cdev,
> + enum led_brightness value)
> +{
> + struct led_classdev_mc *mc_cdev = lcdev_to_mccdev(led_cdev);
> + struct pca963x_led *led = container_of(mc_cdev, struct pca963x_led, mc_cdev);
> + unsigned long cached_leds;
> + int ret;
> +
> + led_mc_calc_color_components(mc_cdev, value);
> +
> + guard(mutex)(&led->chip->mutex);
> +
> + cached_leds = led->chip->leds_on;
> + for (unsigned int i = 0; i < mc_cdev->num_colors; i++) {
> + led->led_num = mc_cdev->subled_info[i].channel;
> + ret = pca963x_brightness(led, mc_cdev->subled_info[i].brightness);
> + if (ret)
> + return ret;
[Severity: High]
If an I2C error occurs here on a subsequent iteration of the loop, could the
hardware state become desynchronized from the software state?
Earlier iterations of this loop may have successfully completed and called
pca963x_track_power_state(), which updates the software state in
led->chip->leds_on. However, returning early here skips the
pca963x_sync_power_state() call.
If the early return happens when turning on the LEDs, led->chip->leds_on will
have bits set, but the chip may still be in sleep mode. Future calls to set
brightness would then incorrectly believe the chip is already awake,
potentially leaving the hardware unresponsive until userspace explicitly turns
off every LED on the chip to reset the state.
> +
> + pca963x_track_power_state(led, mc_cdev->subled_info[i].channel,
> + mc_cdev->subled_info[i].brightness);
> + }
> +
> + return pca963x_sync_power_state(led, cached_leds);
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260710-monza-leds-v5-0-a8972d28c28f@oss.qualcomm.com?part=3
next prev parent reply other threads:[~2026-07-10 14:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 13:49 [PATCH v5 0/4] leds: pca963x: Add multicolor support and enable Monza RGB LEDs Loic Poulain
2026-07-10 13:49 ` [PATCH v5 1/4] dt-bindings: leds: nxp,pca963x: fix reg maximum for pca9635 Loic Poulain
2026-07-10 13:54 ` sashiko-bot
2026-07-10 13:49 ` [PATCH v5 2/4] dt-bindings: leds: nxp,pca963x: add multicolor LED support Loic Poulain
2026-07-10 13:59 ` sashiko-bot
2026-07-10 13:49 ` [PATCH v5 3/4] leds: pca963x: add multicolor LED class support Loic Poulain
2026-07-10 14:10 ` sashiko-bot [this message]
2026-07-10 13:49 ` [PATCH v5 4/4] arm64: dts: monaco-arduino-monza: microcontroller LEDs Loic Poulain
2026-07-10 14:14 ` 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=20260710141048.8A4801F000E9@smtp.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=loic.poulain@oss.qualcomm.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