mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] commands: led: print actual error code when led_set fails
@ 2019-12-12 19:34 Ahmad Fatoum
  2019-12-13  8:27 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2019-12-12 19:34 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

If led_set fails, the error code is the return value, not errno.
Fix this. While at replace the magic value in the command return code.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 commands/led.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/commands/led.c b/commands/led.c
index a53f0df6a200..b608fcfa2cdb 100644
--- a/commands/led.c
+++ b/commands/led.c
@@ -101,8 +101,8 @@ static int do_led(int argc, char *argv[])
 
 	ret = led_set(led, value);
 	if (ret < 0) {
-		perror("led");
-		return 1;
+		printf("led: %s\n", strerror(-ret));
+		return COMMAND_ERROR;
 	}
 
 	return 0;
-- 
2.24.0


_______________________________________________
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:[~2019-12-13  8:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-12 19:34 [PATCH] commands: led: print actual error code when led_set fails Ahmad Fatoum
2019-12-13  8:27 ` Sascha Hauer

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