[PATCH] commands/led.c: check registered LEDs

Antony Pavlov antonynpavlov at gmail.com
Tue Aug 2 03:08:36 EDT 2011


Signed-off-by: Antony Pavlov <antonynpavlov at gmail.com>
---
 commands/led.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/commands/led.c b/commands/led.c
index afb3fd3..774ba31 100644
--- a/commands/led.c
+++ b/commands/led.c
@@ -37,6 +37,12 @@ static int do_led(struct command *cmdtp, int argc, char *argv[])
 	if (argc == 1) {
 		int i = 0;
 
+		led = led_by_number(i);
+		if (!led) {
+			printf("no registered LEDs\n");
+			return COMMAND_ERROR;
+		}
+
 		printf("registered LEDs:\n");
 
 		while ((led = led_by_number(i))) {
-- 
1.7.5.4




More information about the barebox mailing list