summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2015-10-07 21:45:42 -0700
committerJoe Hershberger <joe.hershberger@ni.com>2015-10-29 14:05:51 -0500
commita16edabe7f744b2d7a97bba4d4bc95b6894fd592 (patch)
tree557ab362dfb12072c5066bed1802cce3e0ed6b47 /net
parent50dae85c713e11c52abf25dfd283db336257dbc5 (diff)
downloadu-boot-imx-a16edabe7f744b2d7a97bba4d4bc95b6894fd592.zip
u-boot-imx-a16edabe7f744b2d7a97bba4d4bc95b6894fd592.tar.gz
u-boot-imx-a16edabe7f744b2d7a97bba4d4bc95b6894fd592.tar.bz2
net: eth: Clear MAC address in eth_pre_remove()
platdata->enetaddr was assigned to a value in dev_probe() last time. If we don't clear it, for dev_probe() at the second time, dm eth will end up treating it as a MAC address from ROM no matter where it came from originally (maybe env, ROM, or even random). Fix this by clearing platdata->enetaddr when removing an Ethernet device. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'net')
-rw-r--r--net/eth.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/eth.c b/net/eth.c
index b978aae..c661775 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -575,8 +575,13 @@ static int eth_post_probe(struct udevice *dev)
static int eth_pre_remove(struct udevice *dev)
{
+ struct eth_pdata *pdata = dev->platdata;
+
eth_get_ops(dev)->stop(dev);
+ /* clear the MAC address */
+ memset(pdata->enetaddr, 0, 6);
+
return 0;
}