mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] devinfo: fix return value
@ 2015-06-23  6:40 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2015-06-23  6:40 UTC (permalink / raw)
  To: Barebox List

devinfo on a non existing device prints:

no such device: blah
devinfo: Operation not permitted

The second message comes because devinfo returns -1 which is -EPERM.

Just return -ENODEV which will print:

devinfo: No such device

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 commands/devinfo.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/commands/devinfo.c b/commands/devinfo.c
index e61aaa2..3c9d6a6 100644
--- a/commands/devinfo.c
+++ b/commands/devinfo.c
@@ -68,11 +68,8 @@ static int do_devinfo(int argc, char *argv[])
 		}
 	} else {
 		dev = get_device_by_name(argv[1]);
-
-		if (!dev) {
-			printf("no such device: %s\n",argv[1]);
-			return -1;
-		}
+		if (!dev)
+			return -ENODEV;
 
 		if (dev->num_resources)
 			printf("Resources:\n");
-- 
2.1.4


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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-06-23  6:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-23  6:40 [PATCH] devinfo: fix return value Sascha Hauer

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