Re: [PATCH v7 6/9] leds: st1202: fix brightness having no effect while pattern mode is active

Manuel Fombuena <[email protected]>
Newsgroups org.kernel.vger.linux-leds,dev.linux.lists.sashiko-reviews
Message-ID <GV1PR08MB84974D82123E82672362C0A9C5F42@GV1PR08MB8497.eurprd08.prod.outlook.com>
On Thu, 2 Jul 2026, [email protected] wrote:

> New issues:
> - [Medium] The return value of `st1202_pwm_pattern_write` is ignored, resulting in missing error handling and I2C error log spam.
> 
> Pre-existing issues:
> - [High] The driver assigns a sleeping function to the LED classdev `.brightness_set` callback, violating the atomic context constraint and exacerbating schedule-while-atomic bugs.
> - [High] Per-channel pattern operations incorrectly overwrite global hardware state, breaking independent channel operation for all other active LEDs.
> - [High] `st1202_led_pattern_set` does not scale the 8-bit brightness values to the 12-bit PWM register scale, resulting in extremely dim patterns.
> - [High] Device node references fetched during `for_each_available_child_of_node_scoped` are not properly acquired, resulting in Use-After-Free when they are accessed later during LED registration.

The comment about the ignored return value of st1202_pwm_pattern_write()
was also raised in the v6 review and addressed in the response to that
review. This is intentional: a transient I2C error on one slot does not
guarantee subsequent writes will also fail. Breaking early would leave
remaining PWM slots unwritten unnecessarily, putting the channel in a
partially updated state. brightness_set() is a void callback and cannot
propagate errors regardless, and st1202_write_reg() already logs each
individual failure via dev_err().

The remaining comments are pre-existing issues outside the scope of
this patch and will be addressed in a follow-up submission.

--
Manuel Fombuena
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.