Commit 03d1da3c authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by David S. Miller

net: ethernet: ax88796: support generating a random mac address

Instead of falling back to 00:00:00:00:00:00 generate a random address
if none is provided via platform data or from the device's register
space.
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent db48cc2d
...@@ -723,6 +723,12 @@ static int ax_init_dev(struct net_device *dev) ...@@ -723,6 +723,12 @@ static int ax_init_dev(struct net_device *dev)
ax->plat->mac_addr) ax->plat->mac_addr)
memcpy(dev->dev_addr, ax->plat->mac_addr, ETH_ALEN); memcpy(dev->dev_addr, ax->plat->mac_addr, ETH_ALEN);
if (!is_valid_ether_addr(dev->dev_addr)) {
eth_hw_addr_random(dev);
dev_info(&dev->dev, "Using random MAC address: %pM\n",
dev->dev_addr);
}
ax_reset_8390(dev); ax_reset_8390(dev);
ei_local->name = "AX88796"; ei_local->name = "AX88796";
......
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