summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/8390
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2017-05-25 22:55:11 +0200
committerDavid S. Miller <davem@davemloft.net>2017-05-26 14:56:19 -0400
commit03d1da3c050b9d0f9536ccd0965af91ab8e1df63 (patch)
tree716de53c24cc8cb66cd85cab1c256bf3059849f6 /drivers/net/ethernet/8390
parentdb48cc2d31ee5b8ad3238633c4d76e473524b677 (diff)
downloadlinux-03d1da3c050b9d0f9536ccd0965af91ab8e1df63.tar.bz2
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>
Diffstat (limited to 'drivers/net/ethernet/8390')
-rw-r--r--drivers/net/ethernet/8390/ax88796.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c
index b0a3b85fc6f8..2f0ee3d7ceb1 100644
--- a/drivers/net/ethernet/8390/ax88796.c
+++ b/drivers/net/ethernet/8390/ax88796.c
@@ -723,6 +723,12 @@ static int ax_init_dev(struct net_device *dev)
ax->plat->mac_addr)
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);
ei_local->name = "AX88796";