[U-Boot] [PATCH v2 03/11] net: Only call halt on a driver that has been init'ed

Joe Hershberger joe.hershberger at ni.com
Sat Jun 30 03:20:54 UTC 2018


With driver model, we were not checking if the state of the device was
marked as active before calling the halt function. Check that the device
is probed and also marked as active. This avoids the case where we were
calling halt on the first device in net_init() and the driver would
operate on bogus data structures causing problems. In this case, the
priv was all 0, so halt() would close STDIN.

Signed-off-by: Joe Hershberger <joe.hershberger at ni.com>
---

Changes in v2: None

 net/eth-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index e4b49229e3..fa3f5497a2 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -307,7 +307,7 @@ void eth_halt(void)
 	struct eth_device_priv *priv;
 
 	current = eth_get_dev();
-	if (!current || !device_active(current))
+	if (!current || !eth_is_active(current))
 		return;
 
 	eth_get_ops(current)->stop(current);
-- 
2.11.0



More information about the U-Boot mailing list