[PATCH] net: Fix error return value for string_to_ethaddr

Sascha Hauer s.hauer at pengutronix.de
Mon Jan 20 08:13:07 EST 2014


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

Signed-off-by: Sascha Hauer <s.hauer at 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




More information about the barebox mailing list