When using an USB1 device on a controller that only supports USB2 (e.g. EHCI), reading the first descriptor will fail (read 0 byte), so we can abort the process at this point instead of failing later and wasting time.
Signed-off-by: Paul Kocialkowski <[email protected]> --- common/usb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/usb.c b/common/usb.c index 32e15cd..d1b3316 100644 --- a/common/usb.c +++ b/common/usb.c @@ -950,7 +950,7 @@ int usb_new_device(struct usb_device *dev) */ #ifndef CONFIG_USB_XHCI err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, desc, 64); - if (err < 0) { + if (err < sizeof(struct usb_device_descriptor)) { debug("usb_new_device: usb_get_descriptor() failed\n"); return 1; } @@ -990,6 +990,9 @@ int usb_new_device(struct usb_device *dev) case 64: dev->maxpacketsize = PACKET_SIZE_64; break; + default: + debug("usb_new_device: invalid max packet size\n"); + return 1; } dev->devnum = addr; -- 1.9.1 _______________________________________________ U-Boot mailing list [email protected] http://lists.denx.de/mailman/listinfo/u-boot

