From d5a70bdfd5b09d8438b8883e72f02f0d11d90e0e Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Sat, 10 Feb 2018 11:57:28 +0100 Subject: 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 Reviewed-on: https://review.coreboot.org/23688 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner --- payloads/libpayload/drivers/usb/usb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'payloads/libpayload') 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; } -- cgit v1.2.3