On 07/07/2025 11:24, Philip Oberfichtner wrote:
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 <[email protected]>
[1]
https://lore.kernel.org/u-boot/[email protected]/
---
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)
Reviewed-by: Andrew Goodbody <[email protected]>