From: sashiko-bot@kernel.org
To: "Manuel Fombuena" <fombuena@outlook.com>
Cc: lee@kernel.org, linux-leds@vger.kernel.org
Subject: Re: [PATCH v1 03/11] leds: st1202: Name pattern index variables consistently
Date: Sat, 12 Sep 2026 22:51:06 +0000 [thread overview]
Message-ID: <20260912225106.9BAD81F000FF@smtp.kernel.org> (raw)
In-Reply-To: <GV1PR08MB8497495AB757A3CFF797654EC5BD2@GV1PR08MB8497.eurprd08.prod.outlook.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
Pre-existing issues:
- [High] Incomplete cleanup of remaining hardware pattern durations in st1202_led_pattern_set.
- [High] Global hardware duration registers are corrupted by independent LED pattern or blink requests.
- [High] st1202_blink_set inadvertently turns off continuously lit LEDs.
--
commit 46a022fdeb18fd45b309d2df4aa547f0116cf2c4
Author: Manuel Fombuena <fombuena@outlook.com>
leds: st1202: Name pattern index variables consistently
This commit renames the loop variables for pattern indices from "patt"
to "pattern" across several functions to maintain consistency. It also
renames the "pattern" array parameter to "patterns" in
st1202_led_pattern_set() to avoid shadowing.
> diff --git a/drivers/leds/leds-st1202.c b/drivers/leds/leds-st1202.c
> index d8a04e96fb46c..ddb8c60277067 100644
> --- a/drivers/leds/leds-st1202.c
> +++ b/drivers/leds/leds-st1202.c
[ ... ]
> @@ -251,12 +252,13 @@ static int st1202_led_pattern_set(struct led_classdev *ldev,
> if (ret != 0)
> return ret;
>
> - for (int patt = 0; patt < len; patt++) {
> - ret = st1202_pwm_pattern_write(chip, led->led_num, patt, pattern[patt].brightness);
> + for (int pattern = 0; pattern < len; pattern++) {
> + ret = st1202_pwm_pattern_write(chip, led->led_num, pattern,
> + patterns[pattern].brightness);
> if (ret != 0)
> return ret;
>
> - ret = st1202_duration_pattern_write(chip, patt, pattern[patt].delta_t);
> + ret = st1202_duration_pattern_write(chip, pattern, patterns[pattern].delta_t);
[Severity: High]
This isn't a bug introduced by this patch, but will this write clobber
any pattern durations set by other LEDs?
Since the ST1202_PATTERN_DUR registers are global to the chip, if userspace
sets a pattern on one LED, and then sets a pattern or blink on another LED,
it seems the second LED's duration writes will overwrite the first LED's
timing.
The driver appears to expose shared hardware state as independent without
-EBUSY synchronization, and this behavior remains unresolved at the end of
the patch series.
> if (ret != 0)
> return ret;
> }
[Severity: High]
This is a pre-existing issue, but does this function leave durations for
trailing slots intact?
The loop sets durations up to 'len', but finishes without zeroing the global
duration registers for slots 'len' through ST1202_MAX_PATTERNS - 1.
Could this cause the hardware sequencer to execute trailing steps from a
previous longer pattern? During these ghost steps, the LED would be off,
which could lead to unexpected dark pauses that break the timing of the new
shorter pattern. This can be triggered if userspace sets a long pattern
followed by a short pattern via sysfs on the same LED.
This behavior persists through the entire patch series (including patch 5
which only clears the PWM registers, failing to clear the duration registers).
Also, looking at st1202_blink_set() which is not modified in this patch:
drivers/leds/leds-st1202.c:st1202_blink_set() {
...
/* Zero out PWM for all other active channels to prevent them from blinking */
for (int chan = 0; chan < ST1202_MAX_LEDS; chan++) {
if (!chip->leds[chan].is_active || chan == led->led_num)
continue;
ret = st1202_pwm_pattern_write(chip, chan, 0, LED_OFF);
if (ret)
return ret;
ret = st1202_pwm_pattern_write(chip, chan, 1, LED_OFF);
...
}
[Severity: High]
This isn't a bug introduced by this patch, but does st1202_blink_set()
inadvertently turn off continuously lit LEDs?
This unconditionally clears the first two pattern slots for all other channels,
which ruins the ST1202_PATTERN_PWM_FULL state set by st1202_led_set() and
forces them OFF.
If a second LED is set to a continuous brightness, and userspace requests a
blink on the first LED, st1202_blink_set() will overwrite the second LED's
slots 0 and 1 to LED_OFF. Since the global sequencer loops only over slots 0
and 1 during blink, the second LED will output 0 brightness.
This remains unresolved at the end of the patch series (including patch 10).
--
Sashiko AI review · https://sashiko.dev/#/patchset/GV1PR08MB8497422B7A44424C4968AEC1C5BD2@GV1PR08MB8497.eurprd08.prod.outlook.com?part=3
next prev parent reply other threads:[~2026-09-12 22:51 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-12 22:27 [PATCH v1 00/11] leds: st1202: Naming cleanups and pre-existing fixes Manuel Fombuena
2026-09-12 22:29 ` [PATCH v1 01/11] leds: st1202: Correct the name of the prescaler conversion helper Manuel Fombuena
2026-09-12 22:51 ` sashiko-bot
2026-09-12 22:30 ` [PATCH v1 02/11] leds: st1202: Spell out the phase-shift configuration bit Manuel Fombuena
2026-09-12 22:50 ` sashiko-bot
2026-09-12 22:31 ` [PATCH v1 03/11] leds: st1202: Name pattern index variables consistently Manuel Fombuena
2026-09-12 22:51 ` sashiko-bot [this message]
2026-09-12 22:32 ` [PATCH v1 04/11] leds: st1202: Use u8 consistently for 8-bit values Manuel Fombuena
2026-09-12 22:46 ` sashiko-bot
2026-09-12 22:34 ` [PATCH v1 05/11] leds: st1202: Clear unused pattern slots in pattern_set() Manuel Fombuena
2026-09-12 22:52 ` sashiko-bot
2026-09-12 22:35 ` [PATCH v1 06/11] leds: st1202: Scale pattern brightness to the 12-bit PWM range Manuel Fombuena
2026-09-12 22:51 ` sashiko-bot
2026-09-12 22:36 ` [PATCH v1 07/11] leds: st1202: Program the channel current for hardware patterns Manuel Fombuena
2026-09-12 22:49 ` sashiko-bot
2026-09-12 22:37 ` [PATCH v1 08/11] leds: st1202: Take a reference on the LED firmware node Manuel Fombuena
2026-09-12 22:47 ` sashiko-bot
2026-09-12 22:38 ` [PATCH v1 09/11] leds: st1202: Do not set brightness from atomic context Manuel Fombuena
2026-09-12 22:46 ` sashiko-bot
2026-09-12 22:39 ` [PATCH v1 10/11] leds: st1202: Clear unused pattern slots in blink_set() Manuel Fombuena
2026-09-12 22:51 ` sashiko-bot
2026-09-12 22:40 ` [PATCH v1 11/11] leds: st1202: Honour max_brightness when blinking Manuel Fombuena
2026-09-12 22:55 ` 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=20260912225106.9BAD81F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=fombuena@outlook.com \
--cc=lee@kernel.org \
--cc=linux-leds@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.