summaryrefslogtreecommitdiffstats
path: root/commands/led.c
diff options
context:
space:
mode:
authorAntony Pavlov <antonynpavlov@gmail.com>2011-08-02 11:08:36 +0400
committerSascha Hauer <s.hauer@pengutronix.de>2011-08-03 09:22:21 +0200
commit5c94a23f54cec808180fcbf519f466e2ca243bb2 (patch)
treee39cd51ce959fbd50d239ba49b584ad674c3bcfb /commands/led.c
parentb626a746a025c112eb4d00aec2ec78f4a7132324 (diff)
downloadbarebox-5c94a23f54cec808180fcbf519f466e2ca243bb2.tar.gz
commands/led.c: check registered LEDs
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/led.c')
-rw-r--r--commands/led.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/commands/led.c b/commands/led.c
index 360ce7c..7fd9d44 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))) {