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:
Gerd Hoffmann 2013-03-19 09:18:20 +01:00
parent c874ea97b9
commit c94a7c6979
1 changed files with 3 additions and 0 deletions

View File

@ -3290,6 +3290,9 @@ static int usb_xhci_initfn(struct PCIDevice *dev)
if (xhci->numintrs > MAXINTRS) {
xhci->numintrs = MAXINTRS;
}
while (xhci->numintrs & (xhci->numintrs - 1)) { /* ! power of 2 */
xhci->numintrs++;
}
if (xhci->numintrs < 1) {
xhci->numintrs = 1;
}