Skip to content

Commit 03d1da3

Browse files
Uwe Kleine-Königdavem330
authored andcommitted
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: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent db48cc2 commit 03d1da3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/net/ethernet/8390/ax88796.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,12 @@ static int ax_init_dev(struct net_device *dev)
723723
ax->plat->mac_addr)
724724
memcpy(dev->dev_addr, ax->plat->mac_addr, ETH_ALEN);
725725

726+
if (!is_valid_ether_addr(dev->dev_addr)) {
727+
eth_hw_addr_random(dev);
728+
dev_info(&dev->dev, "Using random MAC address: %pM\n",
729+
dev->dev_addr);
730+
}
731+
726732
ax_reset_8390(dev);
727733

728734
ei_local->name = "AX88796";

0 commit comments

Comments
 (0)