net: eth-uclass: call stop only for active devices

Currently stop is being called unconditionally without even
checking if start is called which will result in crash where
multiple instances are present and stop gets called even
without calling start.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
This commit is contained in:
Keerthy 2021-06-23 20:40:47 +05:30 committed by Praneeth Bajjuri
parent bad069367c
commit 2ae138d289
1 changed files with 2 additions and 1 deletions

View File

@ -590,7 +590,8 @@ static int eth_pre_remove(struct udevice *dev)
{
struct eth_pdata *pdata = dev->platdata;
eth_get_ops(dev)->stop(dev);
if (eth_is_active(dev))
eth_get_ops(dev)->stop(dev);
/* clear the MAC address */
memset(pdata->enetaddr, 0, ARP_HLEN);