[PATCH 4/6] net: fix eth device unregistration

Sascha Hauer s.hauer at pengutronix.de
Wed Feb 15 03:04:02 EST 2012


We register a device in eth_register, thus we have to unregister it in
eth_unregister. Also, if the device we unregister is the current device,
we have to set the current eth_device to NULL so that it isn't used anymore.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 net/eth.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/net/eth.c b/net/eth.c
index 621cb59..20fdbf4 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -244,8 +244,11 @@ int eth_register(struct eth_device *edev)
 
 void eth_unregister(struct eth_device *edev)
 {
-	dev_remove_parameters(&edev->dev);
+	if (edev == eth_current)
+		eth_current = NULL;
 
+	dev_remove_parameters(&edev->dev);
+	unregister_device(&edev->dev);
 	list_del(&edev->list);
 }
 
-- 
1.7.9




More information about the barebox mailing list