Commit 620b6ded authored by Jessica Liu's avatar Jessica Liu Committed by Thomas Gleixner
Browse files

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: 5122e380 ("irqchip/riscv-aplic: Add ACPI support")
Signed-off-by: default avatarJessica Liu <liu.xuemei1@zte.com.cn>
Signed-off-by: default avatarThomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260310141600411Fu8H8-GXOOgKISU48Tjgx@zte.com.cn
parent 1f318b96
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -372,10 +372,13 @@ static int aplic_probe(struct platform_device *pdev)
		rc = aplic_msi_setup(dev, regs);
	else
		rc = aplic_direct_setup(dev, regs);
	if (rc)

	if (rc) {
		dev_err_probe(dev, rc, "failed to setup APLIC in %s mode\n",
			      msi_mode ? "MSI" : "direct");
	else
		return rc;
	}

	register_syscore(&aplic_syscore);

#ifdef CONFIG_ACPI
@@ -383,7 +386,7 @@ static int aplic_probe(struct platform_device *pdev)
		acpi_dev_clear_dependencies(ACPI_COMPANION(dev));
#endif

	return rc;
	return 0;
}

static const struct of_device_id aplic_match[] = {