[PATCH] EDAC/mpc85xx: don't use devm for request_irq()

From: Rosen Penev

Date: Thu Jul 30 2026 - 21:12:58 EST


Use modern irq acquisition APIs to avoid having to call
irq_dispose_mapping() since there's no real need to copy the mapping.

Use non devm version of request_irq() as IRQ need to be freed before
edac_device_del_device() to avoid a use after free issue.

Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
---
drivers/edac/mpc85xx_edac.c | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index a78d702674f6..651d14b01e25 100644
--- a/drivers/edac/mpc85xx_edac.c
+++ b/drivers/edac/mpc85xx_edac.c
@@ -253,15 +253,19 @@ static int mpc85xx_pci_err_probe(struct platform_device *op)
}

if (edac_op_state == EDAC_OPSTATE_INT) {
- pdata->irq = irq_of_parse_and_map(of_node, 0);
- res = devm_request_irq(&op->dev, pdata->irq,
+ pdata->irq = of_irq_get(of_node, 0);
+ if (pdata->irq < 0) {
+ res = pdata->irq;
+ goto err2;
+ }
+
+ res = request_irq(pdata->irq,
mpc85xx_pci_isr,
IRQF_SHARED,
"[EDAC] PCI err", pci);
if (res < 0) {
pr_err("%s: Unable to request irq %d for MPC85xx PCI err\n",
__func__, pdata->irq);
- irq_dispose_mapping(pdata->irq);
res = -ENODEV;
goto err2;
}
@@ -304,6 +308,9 @@ static void mpc85xx_pci_err_remove(struct platform_device *op)

edac_dbg(0, "\n");

+ if (edac_op_state == EDAC_OPSTATE_INT)
+ free_irq(pdata->irq, edac_dev);
+
out_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_ADDR, orig_pci_err_cap_dr);
out_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_EN, orig_pci_err_en);

@@ -558,14 +565,18 @@ static int mpc85xx_l2_err_probe(struct platform_device *op)
}

if (edac_op_state == EDAC_OPSTATE_INT) {
- pdata->irq = irq_of_parse_and_map(op->dev.of_node, 0);
- res = devm_request_irq(&op->dev, pdata->irq,
+ pdata->irq = platform_get_irq(op, 0);
+ if (pdata->irq < 0) {
+ res = pdata->irq;
+ goto err2;
+ }
+
+ res = request_irq(pdata->irq,
mpc85xx_l2_isr, IRQF_SHARED,
"[EDAC] L2 err", edac_dev);
if (res < 0) {
pr_err("%s: Unable to request irq %d for MPC85xx L2 err\n",
__func__, pdata->irq);
- irq_dispose_mapping(pdata->irq);
res = -ENODEV;
goto err2;
}
@@ -597,7 +608,7 @@ static void mpc85xx_l2_err_remove(struct platform_device *op)

if (edac_op_state == EDAC_OPSTATE_INT) {
out_be32(pdata->l2_vbase + MPC85XX_L2_ERRINTEN, 0);
- irq_dispose_mapping(pdata->irq);
+ free_irq(pdata->irq, edac_dev);
}

out_be32(pdata->l2_vbase + MPC85XX_L2_ERRDIS, orig_l2_err_disable);
--
2.55.0