xhci: move sanity checks
The v variable goes negative for reg < 0x20. Reorder the code to first sanity check then calculate v and assign intr to make sanity checkers happy. Buglink: https://bugs.launchpad.net/qemu/+bug/1902112 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20201105134112.25119-7-kraxel@redhat.com
This commit is contained in:
parent
22abfc96af
commit
c590fe3aa2
@ -3010,14 +3010,17 @@ static void xhci_runtime_write(void *ptr, hwaddr reg,
|
|||||||
uint64_t val, unsigned size)
|
uint64_t val, unsigned size)
|
||||||
{
|
{
|
||||||
XHCIState *xhci = ptr;
|
XHCIState *xhci = ptr;
|
||||||
int v = (reg - 0x20) / 0x20;
|
XHCIInterrupter *intr;
|
||||||
XHCIInterrupter *intr = &xhci->intr[v];
|
int v;
|
||||||
|
|
||||||
trace_usb_xhci_runtime_write(reg, val);
|
trace_usb_xhci_runtime_write(reg, val);
|
||||||
|
|
||||||
if (reg < 0x20) {
|
if (reg < 0x20) {
|
||||||
trace_usb_xhci_unimplemented("runtime write", reg);
|
trace_usb_xhci_unimplemented("runtime write", reg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
v = (reg - 0x20) / 0x20;
|
||||||
|
intr = &xhci->intr[v];
|
||||||
|
|
||||||
switch (reg & 0x1f) {
|
switch (reg & 0x1f) {
|
||||||
case 0x00: /* IMAN */
|
case 0x00: /* IMAN */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user