From: Hans de Goede Date: Fri, 14 Dec 2012 13:35:39 +0000 (+0100) Subject: usb: Fix usb_ep_find_packet_by_id X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=6735d433729f80fab80c0a1f70ae131398645613;p=qemu.git usb: Fix usb_ep_find_packet_by_id 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 Signed-off-by: Gerd Hoffmann --- diff --git a/hw/usb/core.c b/hw/usb/core.c index e315fc1021..d057aab900 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; }