[PATCH] net: Fix error return value for string_to_ethaddr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux