summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/sbi/sbi_irqchip.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sbi/sbi_irqchip.c b/lib/sbi/sbi_irqchip.c
index d6771fa8..b490a3ad 100644
--- a/lib/sbi/sbi_irqchip.c
+++ b/lib/sbi/sbi_irqchip.c
@@ -392,7 +392,7 @@ int sbi_irqchip_register_msi(struct sbi_irqchip_device *chip, u32 num_hwirq,
if (h->first_hwirq <= hwirq && hwirq < (h->first_hwirq + h->num_hwirq)) {
hwirq = h->first_hwirq + h->num_hwirq;
} else if (hwirq < h->first_hwirq) {
- if (h->first_hwirq - hwirq < num_hwirq) {
+ if (h->first_hwirq - hwirq >= num_hwirq) {
found = true;
break;
} else {
@@ -400,7 +400,7 @@ int sbi_irqchip_register_msi(struct sbi_irqchip_device *chip, u32 num_hwirq,
}
}
}
- if (!found && !hwirq)
+ if (!found && (chip->num_hwirq - hwirq) >= num_hwirq)
found = true;
if (!found)
return SBI_ENOSPC;