From e9a079f1f145fd07e45aeab9911764c8b45a0b10 Mon Sep 17 00:00:00 2001 From: Nicolas Boichat Date: Wed, 22 Mar 2017 14:16:13 +0800 Subject: [PATCH] chip/stm32/usb-stream: Fix rx_read queue space comparison There is no reason to reject the incoming USB packet if its size equals the amount of space in the queue. BRANCH=none BUG=b:35587171 TEST=usb_updater2 works fine, even with 64-byte USB packets. Change-Id: I2e54f1a758dd8a370dacdc8c2519bbd91e9cb4e5 Reviewed-on: https://chromium-review.googlesource.com/458042 Commit-Ready: Nicolas Boichat Tested-by: Nicolas Boichat Reviewed-by: Vincent Palatin --- chip/stm32/usb-stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chip/stm32/usb-stream.c b/chip/stm32/usb-stream.c index 45c57e6ab1..313e29e8df 100644 --- a/chip/stm32/usb-stream.c +++ b/chip/stm32/usb-stream.c @@ -24,7 +24,7 @@ static size_t rx_read(struct usb_stream_config const *config) * Only read the received USB packet if there is enough space in the * receive queue. */ - if (count >= queue_space(config->producer.queue)) + if (count > queue_space(config->producer.queue)) return 0; return queue_add_memcpy(config->producer.queue,