[PATCH] led: Fix toggling LED on initial SW blink
Francois Berder
fberder at outlook.fr
Sat May 9 19:30:53 CEST 2026
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 at outlook.fr>
---
drivers/led/led_sw_blink.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/led/led_sw_blink.c b/drivers/led/led_sw_blink.c
index ee1546d02d4..4190fde8f0f 100644
--- a/drivers/led/led_sw_blink.c
+++ b/drivers/led/led_sw_blink.c
@@ -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;
--
2.43.0
More information about the U-Boot
mailing list