diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2017-05-25 23:55:11 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-05-26 21:56:19 +0300 |
commit | 03d1da3c050b9d0f9536ccd0965af91ab8e1df63 (patch) | |
tree | 716de53c24cc8cb66cd85cab1c256bf3059849f6 /drivers/net/ethernet/8390 | |
parent | db48cc2d31ee5b8ad3238633c4d76e473524b677 (diff) | |
download | linux-03d1da3c050b9d0f9536ccd0965af91ab8e1df63.tar.xz |
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.c | 6 |
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"; |