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>
This commit is contained in:
Patrick Rudolph 2018-02-10 11:57:28 +01:00 committed by Nico Huber
parent c733540bc9
commit d5a70bdfd5
1 changed files with 4 additions and 4 deletions

View File

@ -173,10 +173,10 @@ get_descriptor(usbdev_t *dev, int rtype, int desc_type, int desc_idx,
ret = dev->controller->control(dev, IN, ret = dev->controller->control(dev, IN,
sizeof(dr), &dr, len, data); sizeof(dr), &dr, len, data);
if (ret)
if (ret == len)
break;
udelay(10); udelay(10);
else
return 0;
} }
return ret; return ret;
} }