From: Bin Meng Date: Wed, 7 Oct 2015 21:45:42 -0700 Subject: [U-Boot] [PATCH v3 1/3] net: eth: Clear MAC address in eth_pre_remove() Message-ID: <1444279544-31914-1-git-send-email-bmeng.cn@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- Changes in v3: - Update commit message to mention the reason of why Changes in v2: - New patch to clear MAC address in eth_pre_remove() net/eth.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/eth.c b/net/eth.c index 2e24b55..0d66f33 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; } -- 1.8.2.1