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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox


[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux