[U-Boot] [PATCH v2 3/9] usb_kdb: only process events succesfully received

Michal Suchanek msuchanek at suse.de
Tue Jul 2 17:55:28 UTC 2019


On error the data buffer does not contain valid data so do not submit it
for processing. Usually it will contain the last data recieved so the
last pressed key will be repeated indefinitely on device failure.

Signed-off-by: Michal Suchanek <msuchanek at suse.de>
---
v2: fix indentation
---
 common/usb_kbd.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index 020f0d4117f7..74206d2de74f 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -317,10 +317,9 @@ static inline void usb_kbd_poll_for_event(struct usb_device *dev)
 	struct usb_kbd_pdata *data = dev->privptr;
 
 	/* Submit a interrupt transfer request */
-	usb_submit_int_msg(dev, data->intpipe, &data->new[0], data->intpktsize,
-			   data->intinterval);
-
-	usb_kbd_irq_worker(dev);
+	if (!usb_submit_int_msg(dev, data->intpipe, &data->new[0],
+				  data->intpktsize, data->intinterval))
+		usb_kbd_irq_worker(dev);
 #elif defined(CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP) || \
       defined(CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE)
 #if defined(CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP)
-- 
2.21.0



More information about the U-Boot mailing list