Skip to content

Commit 81a91ab

Browse files
chenhuacaiKAGA-KOKO
authored andcommitted
irqchip/loongarch-cpu: Fix return value of lpic_gsi_to_irq()
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]
1 parent 1722389 commit 81a91ab

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/irqchip/irq-loongarch-cpu.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ struct fwnode_handle *cpuintc_handle;
1818

1919
static u32 lpic_gsi_to_irq(u32 gsi)
2020
{
21+
int irq = 0;
22+
2123
/* Only pch irqdomain transferring is required for LoongArch. */
2224
if (gsi >= GSI_MIN_PCH_IRQ && gsi <= GSI_MAX_PCH_IRQ)
23-
return acpi_register_gsi(NULL, gsi, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_HIGH);
25+
irq = acpi_register_gsi(NULL, gsi, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_HIGH);
2426

25-
return 0;
27+
return (irq > 0) ? irq : 0;
2628
}
2729

2830
static struct fwnode_handle *lpic_get_gsi_domain_id(u32 gsi)

0 commit comments

Comments
 (0)