[U-Boot] [PATCHv6 08/28] net: cosmetic: Do not use magic values for ARP_HLEN

Olliver Schinagl oliver at schinagl.nl
Mon May 15 08:02:24 UTC 2017


Previously overlooked magic value in commit a40db6d51171 ("net: cosmetic: Do
not use magic values for ARP_HLEN")

Signed-off-by: Olliver Schinagl <oliver at schinagl.nl>
---
 include/net.h    | 4 ++--
 net/eth_common.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/net.h b/include/net.h
index ed5259a807..c703c62c99 100644
--- a/include/net.h
+++ b/include/net.h
@@ -275,7 +275,7 @@ int usb_ether_init(void);
  * Args:
  *	base_name - base name for device (normally "eth")
  *	index - device index number (0 for first)
- *	enetaddr - returns 6 byte hardware address
+ *	enetaddr - returns ARP_HLEN byte hardware address
  * Returns:
  *	Return true if the address is valid.
  */
@@ -818,7 +818,7 @@ static inline void net_random_ethaddr(uchar *addr)
 	int i;
 	unsigned int seed = get_timer(0);
 
-	for (i = 0; i < 6; i++)
+	for (i = 0; i < ARP_HLEN; i++)
 		addr[i] = rand_r(&seed);
 
 	addr[0] &= 0xfe;	/* clear multicast bit */
diff --git a/net/eth_common.c b/net/eth_common.c
index 58fa295771..049c1ee6f9 100644
--- a/net/eth_common.c
+++ b/net/eth_common.c
@@ -17,7 +17,7 @@ void eth_parse_enetaddr(const char *addr, uchar *enetaddr)
 	char *end;
 	int i;
 
-	for (i = 0; i < 6; ++i) {
+	for (i = 0; i < ARP_HLEN; ++i) {
 		enetaddr[i] = addr ? simple_strtoul(addr, &end, 16) : 0;
 		if (addr)
 			addr = (*end) ? end + 1 : end;
-- 
2.11.0



More information about the U-Boot mailing list