Blame 0310-ehci-check-for-EHCI_ASYNC_FINISHED-first-in-ehci_fre.patch

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