mirror of https://github.com/xemu-project/xemu.git
xhci: fix numintrs sanity checks
Make sure numintrs is a power of two, msi requires this. https://bugzilla.redhat.com/show_bug.cgi?id=918035 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
c874ea97b9
commit
c94a7c6979
|
@ -3290,6 +3290,9 @@ static int usb_xhci_initfn(struct PCIDevice *dev)
|
||||||
if (xhci->numintrs > MAXINTRS) {
|
if (xhci->numintrs > MAXINTRS) {
|
||||||
xhci->numintrs = MAXINTRS;
|
xhci->numintrs = MAXINTRS;
|
||||||
}
|
}
|
||||||
|
while (xhci->numintrs & (xhci->numintrs - 1)) { /* ! power of 2 */
|
||||||
|
xhci->numintrs++;
|
||||||
|
}
|
||||||
if (xhci->numintrs < 1) {
|
if (xhci->numintrs < 1) {
|
||||||
xhci->numintrs = 1;
|
xhci->numintrs = 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue