mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] net: Fix error return value for string_to_ethaddr
@ 2014-01-20 13:13 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2014-01-20 13:13 UTC (permalink / raw)
  To: barebox

Return a proper error code instead of -1 which would be -EPERM.

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

diff --git a/net/net.c b/net/net.c
index 9ef0784..20051bc 100644
--- a/net/net.c
+++ b/net/net.c
@@ -143,12 +143,12 @@ int string_to_ethaddr(const char *str, u8 enetaddr[6])
 
         if (!str || strlen(str) != 17) {
 		memset(enetaddr, 0, 6);
-		return -1;
+		return -EINVAL;
 	}
 
         if (str[2] != ':' || str[5] != ':' || str[8] != ':' ||
                         str[11] != ':' || str[14] != ':')
-                return -1;
+                return -EINVAL;
 
 	for (reg = 0; reg < 6; ++reg) {
 		enetaddr[reg] = simple_strtoul (str, &e, 16);
-- 
1.8.5.2


_______________________________________________
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:[~2014-01-20 13:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-20 13:13 [PATCH] net: Fix error return value for string_to_ethaddr Sascha Hauer

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