diff options
author | Patrick Rudolph <siro@das-labor.org> | 2018-02-10 11:57:28 +0100 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2018-10-01 16:54:55 +0000 |
commit | d5a70bdfd5b09d8438b8883e72f02f0d11d90e0e (patch) | |
tree | db091ebd278b5bfe1d9bcb70e6a955910b0b5df6 | |
parent | c733540bc9c6c6c2819e6058290e10b08be1f0ca (diff) |
libpayload/drivers/usb: Fix broken retry counter
Exit on first sucessful CONTROL transfer instead of doing
GET_DESCRIPTOR_TRIES iterations.
Tested on qemu using:
qemu-system-x86_64 -bios build/coreboot.rom -M pc -m 2048 -usb \
-device usb-ehci,id=ehci -device usb-mouse -device usb-audio,bus=usb-bus.0 \
-device usb-bt-dongle,bus=usb-bus.0 -device usb-kbd
Change-Id: I7c881c08d94636a43223338e46c876b5f3e27d47
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-on: https://review.coreboot.org/23688
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
-rw-r--r-- | payloads/libpayload/drivers/usb/usb.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/payloads/libpayload/drivers/usb/usb.c b/payloads/libpayload/drivers/usb/usb.c index bb42f89826..a6d5d43c23 100644 --- a/payloads/libpayload/drivers/usb/usb.c +++ b/payloads/libpayload/drivers/usb/usb.c @@ -173,10 +173,10 @@ get_descriptor(usbdev_t *dev, int rtype, int desc_type, int desc_idx, ret = dev->controller->control(dev, IN, sizeof(dr), &dr, len, data); - if (ret) - udelay(10); - else - return 0; + + if (ret == len) + break; + udelay(10); } return ret; } |