mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] commands/led.c: check registered LEDs
@ 2011-08-02  7:08 Antony Pavlov
  2011-08-03  7:22 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Antony Pavlov @ 2011-08-02  7:08 UTC (permalink / raw)
  To: barebox

Signed-off-by: Antony Pavlov <antonynpavlov@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] commands/led.c: check registered LEDs
  2011-08-02  7:08 [PATCH] commands/led.c: check registered LEDs Antony Pavlov
@ 2011-08-03  7:22 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2011-08-03  7:22 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: barebox

On Tue, Aug 02, 2011 at 11:08:36AM +0400, Antony Pavlov wrote:
> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> ---
>  commands/led.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)

Applied to master.

Thanks,
  Sascha

> 
> 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
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-08-03  7:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-02  7:08 [PATCH] commands/led.c: check registered LEDs Antony Pavlov
2011-08-03  7:22 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox