From: Alexey Kardashevskiy Date: Mon, 18 Jul 2016 03:29:08 +0000 (+1000) Subject: xhci: Fix possible side effect from assert() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=f81bb347ef80e94204b719e1d5e827babb556220;p=qemu.git xhci: Fix possible side effect from assert() 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 Message-id: 1468812548-31868-1-git-send-email-aik@ozlabs.ru Signed-off-by: Gerd Hoffmann --- diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index 976bfb0659..188f95416a 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -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;