From: Keerthy Date: Wed, 20 Feb 2019 18:02:46 +0530 Subject: [U-Boot] [PATCH] net: eth-uclass: call stop only for active devices Message-ID: <20190220123246.11330-1-j-keerthy@ti.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Currently stop is being called unconditionally without even checking if start is called. In case of multiple instances eth being present many devices might just be initialized without a start call in such cases stop might lead unpredictable behaviors including aborts and crashes. Hence add a check before calling stop. Signed-off-by: Keerthy --- net/eth-uclass.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/eth-uclass.c b/net/eth-uclass.c index 2ef20df192..26f7e0b8cd 100644 --- a/net/eth-uclass.c +++ b/net/eth-uclass.c @@ -531,7 +531,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); -- 2.17.1