Skip to content

Commit

Permalink
irqchip/loongarch-cpu: Fix return value of lpic_gsi_to_irq()
Browse files Browse the repository at this point in the history
lpic_gsi_to_irq() should return a valid Linux interrupt number if
acpi_register_gsi() succeeds, and return 0 otherwise. But lpic_gsi_to_irq()
converts a negative return value of acpi_register_gsi() to a positive value
silently.

Convert the return value explicitly.

Fixes: e8bba72 ("irqchip / ACPI: Introduce ACPI_IRQ_MODEL_LPIC for LoongArch")
Reported-by: Miao Wang <[email protected]>
Signed-off-by: Huacai Chen <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Reviewed-by: Jiaxun Yang <[email protected]>
Cc: <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
chenhuacai authored and KAGA-KOKO committed Jul 26, 2024
1 parent 1722389 commit 81a91ab
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/irqchip/irq-loongarch-cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ struct fwnode_handle *cpuintc_handle;

static u32 lpic_gsi_to_irq(u32 gsi)
{
int irq = 0;

/* Only pch irqdomain transferring is required for LoongArch. */
if (gsi >= GSI_MIN_PCH_IRQ && gsi <= GSI_MAX_PCH_IRQ)
return acpi_register_gsi(NULL, gsi, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_HIGH);
irq = acpi_register_gsi(NULL, gsi, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_HIGH);

return 0;
return (irq > 0) ? irq : 0;
}

static struct fwnode_handle *lpic_get_gsi_domain_id(u32 gsi)
Expand Down

0 comments on commit 81a91ab

Please sign in to comment.