Skip to content

Commit

Permalink
xhci: Fix possible side effect from assert()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
aik authored and kraxel committed Jul 20, 2016
1 parent 5d32173 commit f81bb34
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion hw/usb/hcd-xhci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit f81bb34

Please sign in to comment.