]> Git Repo - J-u-boot.git/commitdiff
net: eth: Clear MAC address in eth_pre_remove()
authorBin Meng <[email protected]>
Thu, 8 Oct 2015 04:45:42 +0000 (21:45 -0700)
committerJoe Hershberger <[email protected]>
Thu, 29 Oct 2015 19:05:51 +0000 (14:05 -0500)
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 <[email protected]>
Acked-by: Joe Hershberger <[email protected]>
net/eth.c

index b978aae1016f05a2960870ecdb70244be0f54c45..c661775d1ca8f29f6d5bae58e8373d99d6e9ad6b 100644 (file)
--- 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;
 }
 
This page took 0.033762 seconds and 4 git commands to generate.