mvadkert / rpms / qemu

Forked from rpms/qemu 6 years ago
Clone
5544c1b
From b3950fe894e2b26f9dba0888af092cb43d01a466 Mon Sep 17 00:00:00 2001
c8dfc65
From: Gerd Hoffmann <kraxel@redhat.com>
c8dfc65
Date: Fri, 31 Aug 2012 10:31:54 +0200
f375e62
Subject: [PATCH] ehci: check for EHCI_ASYNC_FINISHED first in ehci_free_packet
c8dfc65
c8dfc65
Otherwise we'll see the packet free twice in the trace log even though
c8dfc65
it actually happens only once.
c8dfc65
c8dfc65
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5544c1b
(cherry picked from commit 616789cde2a83fad5e634880fd20214f0c984fd5)
5544c1b
5544c1b
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
c8dfc65
---
c8dfc65
 hw/usb/hcd-ehci.c | 12 ++++++------
c8dfc65
 1 file changed, 6 insertions(+), 6 deletions(-)
c8dfc65
c8dfc65
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
c8dfc65
index 0a6c9ef..23221d0 100644
c8dfc65
--- a/hw/usb/hcd-ehci.c
c8dfc65
+++ b/hw/usb/hcd-ehci.c
c8dfc65
@@ -747,12 +747,6 @@ static EHCIPacket *ehci_alloc_packet(EHCIQueue *q)
c8dfc65
 
c8dfc65
 static void ehci_free_packet(EHCIPacket *p)
c8dfc65
 {
c8dfc65
-    trace_usb_ehci_packet_action(p->queue, p, "free");
c8dfc65
-    if (p->async == EHCI_ASYNC_INFLIGHT) {
c8dfc65
-        usb_cancel_packet(&p->packet);
c8dfc65
-        usb_packet_unmap(&p->packet, &p->sgl);
c8dfc65
-        qemu_sglist_destroy(&p->sgl);
c8dfc65
-    }
c8dfc65
     if (p->async == EHCI_ASYNC_FINISHED) {
c8dfc65
         int state = ehci_get_state(p->queue->ehci, p->queue->async);
c8dfc65
         /* This is a normal, but rare condition (cancel racing completion) */
c8dfc65
@@ -763,6 +757,12 @@ static void ehci_free_packet(EHCIPacket *p)
c8dfc65
         /* state_writeback recurses into us with async == EHCI_ASYNC_NONE!! */
c8dfc65
         return;
c8dfc65
     }
c8dfc65
+    trace_usb_ehci_packet_action(p->queue, p, "free");
c8dfc65
+    if (p->async == EHCI_ASYNC_INFLIGHT) {
c8dfc65
+        usb_cancel_packet(&p->packet);
c8dfc65
+        usb_packet_unmap(&p->packet, &p->sgl);
c8dfc65
+        qemu_sglist_destroy(&p->sgl);
c8dfc65
+    }
c8dfc65
     QTAILQ_REMOVE(&p->queue->packets, p, next);
c8dfc65
     usb_packet_cleanup(&p->packet);
c8dfc65
     g_free(p);