diff mbox series

[3/5] edac: fsl_ddr: add IRQ check

Message ID 20220126200353.14582-4-s.shtylyov@omp.ru (mailing list archive)
State New, archived
Headers show
Series Stop calling request_irq(), etc. with invalid IRQs in the EDAC drivers | expand

Commit Message

Sergey Shtylyov Jan. 26, 2022, 8:03 p.m. UTC
The driver neglects to check the result of platform_get_irq()'s call
and blithely passes the negative error codes to devm_request_irq()
(which takes *unsigned* IRQ #), causing it to fail with -EINVAL,
overriding the original error.  Stop calling devm_request_irq()
with the invalid IRQ #s.

Fixes: 55764ed37eec ("EDAC, fsl_ddr: Fix IRQ dispose warning when module is removed")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
 drivers/edac/fsl_ddr_edac.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/drivers/edac/fsl_ddr_edac.c b/drivers/edac/fsl_ddr_edac.c
index 6d8ea226010d..64f1108726b0 100644
--- a/drivers/edac/fsl_ddr_edac.c
+++ b/drivers/edac/fsl_ddr_edac.c
@@ -586,6 +586,10 @@  int fsl_mc_err_probe(struct platform_device *op)
 
 		/* register interrupts */
 		pdata->irq = platform_get_irq(op, 0);
+		if (pdata->irq < 0) {
+			res = pdata->irq;
+			goto err2;
+		}
 		res = devm_request_irq(&op->dev, pdata->irq,
 				       fsl_mc_isr,
 				       IRQF_SHARED,