diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2012-01-09 08:32:36 (GMT) |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2012-03-03 15:56:04 (GMT) |
commit | e7e982d69c43b89f7e19b63479c8b2e880fbd75c (patch) | |
tree | d933f9627c7a94066118ad31d0b016c8556c1f1b /drivers/usb/eth/usb_ether.c | |
parent | e159e4868ec1c289a7c167da681165e74308c92a (diff) | |
download | u-boot-e7e982d69c43b89f7e19b63479c8b2e880fbd75c.tar.xz |
eth: remove usb-ethernet devices before re-enumerating them
Fix the crash when running several times usb_init() with a USB ethernet
device plugged.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Wolfgang Grandegger <wg@denx.de>
Diffstat (limited to 'drivers/usb/eth/usb_ether.c')
-rw-r--r-- | drivers/usb/eth/usb_ether.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/usb/eth/usb_ether.c b/drivers/usb/eth/usb_ether.c index 48a30eb..6cad6c8 100644 --- a/drivers/usb/eth/usb_ether.c +++ b/drivers/usb/eth/usb_ether.c @@ -127,8 +127,11 @@ int usb_host_eth_scan(int mode) old_async = usb_disable_asynch(1); /* asynch transfer not allowed */ - for (i = 0; i < USB_MAX_ETH_DEV; i++) - memset(&usb_eth[i], 0, sizeof(usb_eth[i])); + /* unregister a previously detected device */ + for (i = 0; i < usb_max_eth_dev; i++) + eth_unregister(&usb_eth[i].eth_dev); + + memset(usb_eth, 0, sizeof(usb_eth)); for (i = 0; prob_dev[i].probe; i++) { if (prob_dev[i].before_probe) |