Commit d0b3fc9c authored by Adam Wujek's avatar Adam Wujek 💬 Committed by Miguel Jimenez Lopez

wr_nic: invert return value of function mac_pton (endpoint.c)

In kernel this function returns 1/true on success!
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent ea930b0a
......@@ -29,21 +29,21 @@ static int mac_pton(const char *s, u8 *mac)
/* XX:XX:XX:XX:XX:XX */
if (strlen(s) < 3 * ETH_ALEN - 1)
return -EINVAL;
return 0;
/* Don't dirty result unless string is valid MAC. */
for (i = 0; i < ETH_ALEN; i++) {
if (!strchr("0123456789abcdefABCDEF", s[i * 3]))
return -EINVAL;
return 0;
if (!strchr("0123456789abcdefABCDEF", s[i * 3 + 1]))
return -EINVAL;
return 0;
if (i != ETH_ALEN - 1 && s[i * 3 + 2] != ':')
return -EINVAL;
return 0;
}
for (i = 0; i < ETH_ALEN; i++) {
mac[i] = (hex_to_bin(s[i * 3]) << 4) | hex_to_bin(s[i * 3 + 1]);
}
return 0;
return 1;
}
/*
......@@ -257,7 +257,7 @@ int wrn_endpoint_probe(struct net_device *dev)
if (is_zero_ether_addr(wraddr)) {
err = mac_pton(macaddr, wraddr);
if (err)
if (!err)
pr_err("wr_nic: probably invalid MAC address \"%s\".\n"
"Use format XX:XX:XX:XX:XX:XX\n", macaddr);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment