Skip to content

Commit 620b6de

Browse files
Jessica LiuThomas Gleixner
authored andcommitted
irqchip/riscv-aplic: Do not clear ACPI dependencies on probe failure
aplic_probe() calls acpi_dev_clear_dependencies() unconditionally at the end, even when the preceding setup (MSI or direct mode) has failed. This is incorrect because if the device failed to probe, it should not be considered as active and should not clear dependencies for other devices waiting on it. Fix this by returning immediately when the setup fails, skipping the ACPI dependency cleanup. Also, explicitly return 0 on success instead of relying on the value of 'rc' to make the success path clear. Fixes: 5122e38 ("irqchip/riscv-aplic: Add ACPI support") Signed-off-by: Jessica Liu <liu.xuemei1@zte.com.cn> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260310141600411Fu8H8-GXOOgKISU48Tjgx@zte.com.cn
1 parent 1f318b9 commit 620b6de

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

drivers/irqchip/irq-riscv-aplic-main.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,18 +372,21 @@ static int aplic_probe(struct platform_device *pdev)
372372
rc = aplic_msi_setup(dev, regs);
373373
else
374374
rc = aplic_direct_setup(dev, regs);
375-
if (rc)
375+
376+
if (rc) {
376377
dev_err_probe(dev, rc, "failed to setup APLIC in %s mode\n",
377378
msi_mode ? "MSI" : "direct");
378-
else
379-
register_syscore(&aplic_syscore);
379+
return rc;
380+
}
381+
382+
register_syscore(&aplic_syscore);
380383

381384
#ifdef CONFIG_ACPI
382385
if (!acpi_disabled)
383386
acpi_dev_clear_dependencies(ACPI_COMPANION(dev));
384387
#endif
385388

386-
return rc;
389+
return 0;
387390
}
388391

389392
static const struct of_device_id aplic_match[] = {

0 commit comments

Comments
 (0)