summaryrefslogtreecommitdiff
path: root/drivers/usb/eth
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2012-01-09 08:32:36 +0000
committerWolfgang Denk <wd@denx.de>2012-03-03 16:56:04 +0100
commite7e982d69c43b89f7e19b63479c8b2e880fbd75c (patch)
treed933f9627c7a94066118ad31d0b016c8556c1f1b /drivers/usb/eth
parente159e4868ec1c289a7c167da681165e74308c92a (diff)
downloadu-boot-imx-e7e982d69c43b89f7e19b63479c8b2e880fbd75c.zip
u-boot-imx-e7e982d69c43b89f7e19b63479c8b2e880fbd75c.tar.gz
u-boot-imx-e7e982d69c43b89f7e19b63479c8b2e880fbd75c.tar.bz2
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')
-rw-r--r--drivers/usb/eth/usb_ether.c7
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)