From patchwork Fri Dec 14 13:35:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 206508 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DFC102C00B0 for ; Sat, 15 Dec 2012 01:23:29 +1100 (EST) Received: from localhost ([::1]:48585 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjWAi-0003aL-0m for incoming@patchwork.ozlabs.org; Fri, 14 Dec 2012 09:23:28 -0500 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 Received: from shalem.localdomain.com (vpn1-6-137.ams2.redhat.com [10.36.6.137]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qBEDXSSw028567; Fri, 14 Dec 2012 08:33:52 -0500 From: Hans de Goede To: Gerd Hoffmann 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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Hans de Goede , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 18/26] usb: Fix usb_ep_find_packet_by_id X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@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; }