diff options
| -rw-r--r-- | sys/x86/x86/msi.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/x86/x86/msi.c b/sys/x86/x86/msi.c index 971b07d7c46fb..6af1a313093c8 100644 --- a/sys/x86/x86/msi.c +++ b/sys/x86/x86/msi.c @@ -409,7 +409,7 @@ again: /* Do we need to create some new sources? */ if (cnt < count) { /* If we would exceed the max, give up. */ - if (i + (count - cnt) >= first_msi_irq + NUM_MSI_INTS) { + if (i + (count - cnt) > first_msi_irq + NUM_MSI_INTS) { mtx_unlock(&msi_lock); free(mirqs, M_MSI); return (ENXIO); @@ -647,13 +647,14 @@ again: break; } + /* Are all IRQs in use? */ + if (i == first_msi_irq + NUM_MSI_INTS) { + mtx_unlock(&msi_lock); + return (ENXIO); + } + /* Do we need to create a new source? */ if (msi == NULL) { - /* If we would exceed the max, give up. */ - if (i + 1 >= first_msi_irq + NUM_MSI_INTS) { - mtx_unlock(&msi_lock); - return (ENXIO); - } mtx_unlock(&msi_lock); /* Create a new source. */ |
