[PATCH 1/1] usb: Fix usb_control_msg() error path
Philip Oberfichtner
pro at denx.de
Mon Jul 7 12:24:30 CEST 2025
As pointed out in [1], there is a logic error in the -ETIMEDOUT return
path.
The while() condition evaluates false, when timeout is 0. Postfix
decrement makes it -1. Adapt the if statement accordingly.
Fixes: 2fc8638403c (usb: Assimilate usb_get_descriptor() to linux)
Signed-off-by: Philip Oberfichtner <pro at denx.de>
[1] https://lore.kernel.org/u-boot/caa9932c-c5dd-46d6-a5ae-120238300a73@linaro.org/
---
common/usb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/usb.c b/common/usb.c
index 7a8435296c6..266339e4897 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -258,7 +258,7 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe,
mdelay(1);
}
- if (timeout == 0)
+ if (timeout == -1)
return -ETIMEDOUT;
if (dev->status)
--
2.39.5
More information about the U-Boot
mailing list