[PATCH 09/10] EDAC/altera: Detach sb_irq handler when db_irq setup fails

Dinh Nguyen <[email protected]> Mon, 27 Jul 2026 08:24:15 -0500
Newsgroups org.kernel.vger.linux-edac,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Message-ID <[email protected]>
altr_edac_a10_probe() installs the sb_irq chained handler before fetching
db_irq. If platform_get_irq() for db_irq fails, the probe returned
without detaching the sb_irq handler, leaving it pointing at the
devm-freed edac struct. Unlink the sb_irq chained handler before
removing the IRQ domain and returning.

Assisted-by: Cursor:claude-4.8-opus
Fixes: d5fc9125566c ("EDAC, altera: Combine Stratix10 and Arria10 probe functions")
Cc: [email protected]
Signed-off-by: Dinh Nguyen <[email protected]>
---
 drivers/edac/altera_edac.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
index 5087aa5ae5612..80ca9f511ac98 100644
--- a/drivers/edac/altera_edac.c
+++ b/drivers/edac/altera_edac.c
@@ -2209,6 +2209,8 @@ static int altr_edac_a10_probe(struct platform_device *pdev)
 	} else {
 		edac->db_irq = platform_get_irq(pdev, 1);
 		if (edac->db_irq < 0) {
+			irq_set_chained_handler_and_data(edac->sb_irq,
+							 NULL, NULL);
 			irq_domain_remove(edac->domain);
 			return edac->db_irq;
 		}
-- 
2.42.0.411.g813d9a9188