Patchwork [U-Boot,v2,4/6] status_led: Print an error when the LED id is out of range

login
register
mail settings
Submitter Otavio Salvador
Date Sept. 28, 2013, 7:19 p.m.
Message ID <1380395965-14125-4-git-send-email-otavio@ossystems.com.br>
Download mbox | patch
Permalink /patch/278765/
State Superseded
Headers show

Comments

Otavio Salvador - Sept. 28, 2013, 7:19 p.m.
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
Changes in v2:
- new patch

 drivers/misc/status_led.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

1.8.4.rc3

Patch

diff --git a/drivers/misc/status_led.c b/drivers/misc/status_led.c
index 6b71ad4..33148c9 100644
--- a/drivers/misc/status_led.c
+++ b/drivers/misc/status_led.c
@@ -94,9 +94,10 @@  void status_led_set (int led, int state)
 {
 	led_dev_t *ld;
 
-	if (led < 0 || led >= MAX_LED_DEV)
+	if (led < 0 || led >= MAX_LED_DEV) {
+		printf("ERROR: LED bit is out of range\n");
 		return;
+	}
 
 	if (!status_led_init_done)
 		status_led_init ();
--