aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ramips/files
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2015-01-28 12:06:22 +0000
committerJohn Crispin <john@openwrt.org>2015-01-28 12:06:22 +0000
commitc56cf3edc7f59ed0f848a31bc307537df847238b (patch)
tree91c9688cc016d06b73b932acb4ac57d5373b16c1 /target/linux/ramips/files
parent09a227a19169b5ce55b8521e34117a3d71372939 (diff)
downloadupstream-c56cf3edc7f59ed0f848a31bc307537df847238b.tar.gz
upstream-c56cf3edc7f59ed0f848a31bc307537df847238b.tar.bz2
upstream-c56cf3edc7f59ed0f848a31bc307537df847238b.zip
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
Diffstat (limited to 'target/linux/ramips/files')
-rw-r--r--target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c
index d7d1e8efc9..9900a5e508 100644
--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c
@@ -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)