Commit 81a91aba authored by Huacai Chen's avatar Huacai Chen Committed by Thomas Gleixner

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: e8bba72b ("irqchip / ACPI: Introduce ACPI_IRQ_MODEL_LPIC for LoongArch")
Reported-by: default avatarMiao Wang <shankerwangmiao@gmail.com>
Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarJiaxun Yang <jiaxun.yang@flygoat.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20240723064508.35560-1-chenhuacai@loongson.cn
parent 1722389b
...@@ -18,11 +18,13 @@ struct fwnode_handle *cpuintc_handle; ...@@ -18,11 +18,13 @@ struct fwnode_handle *cpuintc_handle;
static u32 lpic_gsi_to_irq(u32 gsi) static u32 lpic_gsi_to_irq(u32 gsi)
{ {
int irq = 0;
/* Only pch irqdomain transferring is required for LoongArch. */ /* Only pch irqdomain transferring is required for LoongArch. */
if (gsi >= GSI_MIN_PCH_IRQ && gsi <= GSI_MAX_PCH_IRQ) 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) static struct fwnode_handle *lpic_get_gsi_domain_id(u32 gsi)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment