[PATCH v4 4/9] led: status_led: add warning when an invalid Status LED ID is used

Christian Marangi ansuelsmth at gmail.com
Thu Jun 20 01:03:22 CEST 2024


Add a warning when an invalid Status LED ID is used to make the user
aware of bad configurations.

Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
---
 drivers/misc/status_led.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/status_led.c b/drivers/misc/status_led.c
index 2b904bfa9c2..7912b4a9448 100644
--- a/drivers/misc/status_led.c
+++ b/drivers/misc/status_led.c
@@ -105,8 +105,10 @@ void status_led_tick(ulong timestamp)
 
 static led_dev_t *status_get_led_dev(int led)
 {
-	if (led < 0 || led >= MAX_LED_DEV)
+	if (led < 0 || led >= MAX_LED_DEV) {
+		printf("Invalid Status LED ID %d.", led);
 		return NULL;
+	}
 
 	if (!status_led_init_done)
 		status_led_init();
-- 
2.43.0



More information about the U-Boot mailing list