0 is not a proper IRQ number and also indicates failure. Also check for this case in upwards functions. Signed-off-by: Adam Lackorzynski <adam@xxxxxxxx> --- arch/x86/kernel/apic/io_apic.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index e4ab4804b20d..8ae46a092c88 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c @@ -1007,7 +1007,7 @@ static int alloc_isa_irq_from_domain(struct irq_domain *domain, info->flags |= X86_IRQ_ALLOC_LEGACY; irq = __irq_domain_alloc_irqs(domain, irq, 1, node, info, true, NULL); - if (irq >= 0) { + if (irq > 0) { irq_data = irq_domain_get_irq_data(domain, irq); data = irq_data->chip_data; data->isa_irq = true; @@ -1050,10 +1050,11 @@ static int mp_map_pin_to_irq(u32 gsi, int idx, int ioapic, int pin, irq = alloc_irq_from_domain(domain, ioapic, gsi, &tmp); else if (!mp_check_pin_attr(irq, &tmp)) irq = -EBUSY; - if (irq >= 0) { + if (irq > 0) { data = irq_get_chip_data(irq); data->count++; - } + } else if (irq == 0) + irq = -ENOENT; } mutex_unlock(&ioapic_mutex); -- 2.30.0.rc2