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:
parent
cec6fd5d85
commit
27d4fe7a08
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue