From: Keerthy Date: Tue, 6 Aug 2019 16:08:32 +0530 Subject: [U-Boot] [PATCH 02/14] net: eth-uclass: call stop only for active devices In-Reply-To: <20190806103844.25277-1-j-keerthy@ti.com> References: <20190806103844.25277-1-j-keerthy@ti.com> Message-ID: <20190806103844.25277-3-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 which will result in crash where multiple instances are present and stop gets called even without calling start. 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 f11c307b8c..58d6f26e04 100644 --- a/net/eth-uclass.c +++ b/net/eth-uclass.c @@ -557,7 +557,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