Received: from eggs.gnu.org ([208.118.235.92]:45323) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjVOr-0004SD-0F for qemu-devel@nongnu.org; Fri, 14 Dec 2012 08:34:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TjVOk-0005KB-DX for qemu-devel@nongnu.org; Fri, 14 Dec 2012 08:34:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:30133) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjVOk-0005K5-4t for qemu-devel@nongnu.org; Fri, 14 Dec 2012 08:33:54 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qBEDXr7r021600 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 14 Dec 2012 08:33:53 -0500 From: Hans de Goede Date: Fri, 14 Dec 2012 14:35:39 +0100 Message-Id: <1355492147-5023-19-git-send-email-hdegoede@redhat.com> In-Reply-To: <1355492147-5023-1-git-send-email-hdegoede@redhat.com> References: <1355492147-5023-1-git-send-email-hdegoede@redhat.com> Subject: [Qemu-devel] [PATCH 18/26] usb: Fix usb_ep_find_packet_by_id List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: Hans de Goede , qemu-devel@nongnu.org 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 --- hw/usb/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/usb/core.c b/hw/usb/core.c index 8e360d3..7ecb2a8 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; } -- 1.8.0.1