]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
led: Fix toggling LED on initial SW blink
authorFrancois Berder <fberder@outlook.fr>
Sat, 9 May 2026 17:30:53 +0000 (19:30 +0200)
committerTom Rini <trini@konsulko.com>
Mon, 25 May 2026 19:43:28 +0000 (13:43 -0600)
If the LED is in the ON state, it is briefly set to OFF
then to ON immediately due to falling-through in the default
case.
This commit ensures that no fall-through occurs and thus
a LED initially in the ON state is turned off before blinking.

Signed-off-by: Francois Berder <fberder@outlook.fr>
Fixes: 9e3d83301e4f ("led: toggle LED on initial SW blink")
Acked-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/led/led_sw_blink.c

index ee1546d02d473c37fe8475489122de26aee22bb9..4190fde8f0fc961e16a3abe80bef64cc8b045ad0 100644 (file)
@@ -114,9 +114,11 @@ bool led_sw_on_state_change(struct udevice *dev, enum led_state_t state)
                case LEDST_ON:
                        ops->set_state(dev, LEDST_OFF);
                        sw_blink->state = LED_SW_BLINK_ST_OFF;
+                       break;
                default:
                        ops->set_state(dev, LEDST_ON);
                        sw_blink->state = LED_SW_BLINK_ST_ON;
+                       break;
                }
 
                return true;