ralink: check ethernet MAC address whether it is valid
The mac address usually write in factory block. but sometime user erase this block , the mac address will change to ff:ff:ff:ff:ff:ff. This patch is purpose to fix this issue. Signed-off-by: wengbj <linux.c@foxmail.com> SVN-Revision: 44166
This commit is contained in:
parent
09a227a191
commit
c56cf3edc7
1 changed files with 3 additions and 1 deletions
|
@ -1220,8 +1220,10 @@ static int __init fe_init(struct net_device *dev)
|
|||
if (priv->soc->switch_init)
|
||||
priv->soc->switch_init(priv);
|
||||
|
||||
memcpy(dev->dev_addr, priv->soc->mac, ETH_ALEN);
|
||||
of_get_mac_address_mtd(priv->device->of_node, dev->dev_addr);
|
||||
/*If the mac address is invalid, use default mac address */
|
||||
if (!is_valid_ether_addr(dev->dev_addr))
|
||||
memcpy(dev->dev_addr, priv->soc->mac, ETH_ALEN);
|
||||
|
||||
err = fe_mdio_init(priv);
|
||||
if (err)
|
||||
|
|
Loading…
Reference in a new issue