* [PATCH] leds: lm3692x: fix regulator/gpio leak and wrong enabled state on last write failure
@ 2026-09-15 3:45 Cong Nguyen
2026-09-15 3:52 ` sashiko-bot
2026-09-22 12:48 ` (subset) " Lee Jones
0 siblings, 2 replies; 3+ messages in thread
From: Cong Nguyen @ 2026-09-15 3:45 UTC (permalink / raw)
To: Lee Jones; +Cc: Pavel Machek, Guido Günther, linux-leds, linux-kernel
Every write in lm3692x_leds_enable() checks its return and jumps to
out: on failure -- except the last one, which falls through and sets
led->enabled = true regardless of whether it actually succeeded. Leaks
the regulator on a failing probe, and short-circuits later
brightness_set() calls without retrying.
Route it through out: like every other write here, and only set
enabled = true once it succeeds.
Fixes: 260718b3a35d ("leds: lm3692x: Disable chip on brightness 0")
Assisted-by: Claude:claude-opus-4
Signed-off-by: Cong Nguyen <congnt264@gmail.com>
---
drivers/leds/leds-lm3692x.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/leds/leds-lm3692x.c b/drivers/leds/leds-lm3692x.c
index 8d2678dc9e4f..9c58d54c5783 100644
--- a/drivers/leds/leds-lm3692x.c
+++ b/drivers/leds/leds-lm3692x.c
@@ -276,9 +276,11 @@ static int lm3692x_leds_enable(struct lm3692x_led *led)
ret = regmap_update_bits(led->regmap, LM3692X_EN, LM3692X_ENABLE_MASK,
enable_state | LM3692X_DEVICE_EN);
+ if (ret)
+ goto out;
led->enabled = true;
- return ret;
+ return 0;
out:
dev_err(&led->client->dev, "Fail writing initialization values\n");
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] leds: lm3692x: fix regulator/gpio leak and wrong enabled state on last write failure
2026-09-15 3:45 [PATCH] leds: lm3692x: fix regulator/gpio leak and wrong enabled state on last write failure Cong Nguyen
@ 2026-09-15 3:52 ` sashiko-bot
2026-09-22 12:48 ` (subset) " Lee Jones
1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-09-15 3:52 UTC (permalink / raw)
To: Cong Nguyen; +Cc: lee, linux-leds
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] leds: commit message description is not capitalized
--
commit b25c5a499c39fb9de3dfd21fd5b2889e97d97b83
Author: Cong Nguyen <congnt264@gmail.com>
leds: lm3692x: fix regulator/gpio leak and wrong enabled state on last write failure
This commit addresses an error handling omission in lm3692x_leds_enable(), where
the final write ignores its return value and marks the LED as enabled even on
failure. Routing this through the standard error path prevents regulator leaks
and ensures proper retry behavior.
> leds: lm3692x: fix regulator/gpio leak and wrong enabled state on last write failure
[Severity: Low]
This isn't a bug, but does the commit subject violate the LED subsystem
convention for capitalization? The subsystem guidelines require capitalizing
the description after the prefix (e.g., "leds: lm3692x: Fix regulator...").
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260915034515.4147981-1-congnt264@gmail.com?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: (subset) [PATCH] leds: lm3692x: fix regulator/gpio leak and wrong enabled state on last write failure
2026-09-15 3:45 [PATCH] leds: lm3692x: fix regulator/gpio leak and wrong enabled state on last write failure Cong Nguyen
2026-09-15 3:52 ` sashiko-bot
@ 2026-09-22 12:48 ` Lee Jones
1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2026-09-22 12:48 UTC (permalink / raw)
To: Lee Jones, Cong Nguyen
Cc: Pavel Machek, Guido Günther, linux-leds, linux-kernel
On Tue, 15 Sep 2026 10:45:15 +0700, Cong Nguyen wrote:
> Every write in lm3692x_leds_enable() checks its return and jumps to
> out: on failure -- except the last one, which falls through and sets
> led->enabled = true regardless of whether it actually succeeded. Leaks
> the regulator on a failing probe, and short-circuits later
> brightness_set() calls without retrying.
>
> Route it through out: like every other write here, and only set
> enabled = true once it succeeds.
>
> [...]
Applied, thanks!
[1/1] leds: lm3692x: fix regulator/gpio leak and wrong enabled state on last write failure
commit: 145ca6bca2cc5fd8d9c7af216df58a9c75c0e84c
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-22 12:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-15 3:45 [PATCH] leds: lm3692x: fix regulator/gpio leak and wrong enabled state on last write failure Cong Nguyen
2026-09-15 3:52 ` sashiko-bot
2026-09-22 12:48 ` (subset) " Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox