9
0
Fork 0

net: Fix error return value for string_to_ethaddr

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

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2013-11-11 12:35:21 +01:00
parent cec6fd5d85
commit 27d4fe7a08
1 changed files with 2 additions and 2 deletions

View File

@ -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);