Re: [PATCH v6 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 | <GV1PR08MB849719BB7EAE723EF9D723D6C5F52@GV1PR08MB8497.eurprd08.prod.outlook.com> |
On Thu, 2 Jul 2026, [email protected] wrote: > New issues: > - [Medium] The newly added loop in `st1202_brightness_set` ignores I2C error returns, continuing blindly on bus failures. > > [Severity: Medium] > Is it safe to ignore the return value of st1202_pwm_pattern_write() here? > > If an I2C transaction fails (e.g., due to a temporary bus error), this loop > does not break and unconditionally attempts all 8 iterations. Because the > underlying st1202_write_reg() internally calls dev_err() on failure, a > single bus error will cause 16 consecutive error messages to flood the > kernel log, while pointlessly blocking to attempt writes that are > guaranteed to fail. > > Should the loop check the return value and abort early on failure? 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(). -- Manuel Fombuena