Patchwork [18/32] usb: Fix usb_ep_find_packet_by_id

login
register
mail settings
Submitter Gerd Hoffmann
Date Jan. 8, 2013, 1:14 p.m.
Message ID <1357650894-16982-19-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/210396/
State New
Headers show

Comments

Gerd Hoffmann - Jan. 8, 2013, 1:14 p.m.
From: Hans de Goede <hdegoede@redhat.com>

usb_ep_find_packet_by_id mistakenly only checks the first packet and if that
is not a match, keeps trying the first packet! This patch fixes this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch

diff --git a/hw/usb/core.c b/hw/usb/core.c
index e315fc1..d057aab 100644
--- a/hw/usb/core.c
+++ b/hw/usb/core.c
@@ -761,7 +761,7 @@  USBPacket *usb_ep_find_packet_by_id(USBDevice *dev, int pid, int ep,
     struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);
     USBPacket *p;
 
-    while ((p = QTAILQ_FIRST(&uep->queue)) != NULL) {
+    QTAILQ_FOREACH(p, &uep->queue, queue) {
         if (p->id == id) {
             return p;
         }