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>
This commit is contained in:

committed by
Wolfgang Denk

parent
e159e4868e
commit
e7e982d69c
@@ -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)
|
||||
|
Reference in New Issue
Block a user