]> git.proxmox.com Git - mirror_qemu.git/commitdiff
xhci: Fix possible side effect from assert()
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Mon, 18 Jul 2016 03:29:08 +0000 (13:29 +1000)
committerGerd Hoffmann <kraxel@redhat.com>
Wed, 20 Jul 2016 11:31:09 +0000 (13:31 +0200)
A static analysis tool called BEAM detected possible side effect from
assert() calling a helper which may change an XHCI ring after every call.

This moves xhci_ring_fetch() out of assert() so it will be called
with and without enabled debug.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Message-id: 1468812548-31868-1-git-send-email-aik@ozlabs.ru
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/usb/hcd-xhci.c

index 976bfb06598bad248effe3b358d349df7ef8f35f..188f95416ac4bacc0b0632f92ce3b76f99288e98 100644 (file)
@@ -2201,7 +2201,9 @@ static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid,
         xfer->trb_count = length;
 
         for (i = 0; i < length; i++) {
-            assert(xhci_ring_fetch(xhci, ring, &xfer->trbs[i], NULL));
+            TRBType type;
+            type = xhci_ring_fetch(xhci, ring, &xfer->trbs[i], NULL);
+            assert(type);
         }
         xfer->streamid = streamid;