net: cosmetic: Do not use magic values for ARP_HLEN
Commit 674bb249825a ("net: cosmetic: Replace magic numbers in arp.c with
constants") introduced a nice define to replace the magic value 6 for
the ethernet hardware address. Replace more hardcoded instances of 6
which really reference the ARP_HLEN (iow the MAC/Hardware/Ethernet
address).
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
diff --git a/net/eth_legacy.c b/net/eth_legacy.c
index 1354f49..e4bd0f4 100644
--- a/net/eth_legacy.c
+++ b/net/eth_legacy.c
@@ -121,7 +121,7 @@
eth_write_hwaddr(dev, "eth", dev->index);
break;
case env_op_delete:
- memset(dev->enetaddr, 0, 6);
+ memset(dev->enetaddr, 0, ARP_HLEN);
}
}
dev = dev->next;
@@ -134,14 +134,14 @@
int eth_write_hwaddr(struct eth_device *dev, const char *base_name,
int eth_number)
{
- unsigned char env_enetaddr[6];
+ unsigned char env_enetaddr[ARP_HLEN];
int ret = 0;
eth_getenv_enetaddr_by_index(base_name, eth_number, env_enetaddr);
if (!is_zero_ethaddr(env_enetaddr)) {
if (!is_zero_ethaddr(dev->enetaddr) &&
- memcmp(dev->enetaddr, env_enetaddr, 6)) {
+ memcmp(dev->enetaddr, env_enetaddr, ARP_HLEN)) {
printf("\nWarning: %s MAC addresses don't match:\n",
dev->name);
printf("Address in SROM is %pM\n",
@@ -150,7 +150,7 @@
env_enetaddr);
}
- memcpy(dev->enetaddr, env_enetaddr, 6);
+ memcpy(dev->enetaddr, env_enetaddr, ARP_HLEN);
} else if (is_valid_ethaddr(dev->enetaddr)) {
eth_setenv_enetaddr_by_index(base_name, eth_number,
dev->enetaddr);
@@ -299,7 +299,7 @@
*/
int eth_mcast_join(struct in_addr mcast_ip, int join)
{
- u8 mcast_mac[6];
+ u8 mcast_mac[ARP_HLEN];
if (!eth_current || !eth_current->mcast)
return -1;
mcast_mac[5] = htonl(mcast_ip.s_addr) & 0xff;