diff mbox series

[4/5] edac: highbank_l2: add IRQ checks

Message ID 20220126200353.14582-5-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 calls
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: 69154d069869 ("edac: add support for Calxeda highbank L2 cache ecc")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
 drivers/edac/highbank_l2_edac.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/drivers/edac/highbank_l2_edac.c b/drivers/edac/highbank_l2_edac.c
index c4549cec788b..e58c84f8e624 100644
--- a/drivers/edac/highbank_l2_edac.c
+++ b/drivers/edac/highbank_l2_edac.c
@@ -94,6 +94,10 @@  static int highbank_l2_err_probe(struct platform_device *pdev)
 		goto err;
 
 	drvdata->db_irq = platform_get_irq(pdev, 0);
+	if (drvdata->db_irq < 0) {
+		res = drvdata->db_irq;
+		goto err2;
+	}
 	res = devm_request_irq(&pdev->dev, drvdata->db_irq,
 			       highbank_l2_err_handler,
 			       0, dev_name(&pdev->dev), dci);
@@ -101,6 +105,10 @@  static int highbank_l2_err_probe(struct platform_device *pdev)
 		goto err2;
 
 	drvdata->sb_irq = platform_get_irq(pdev, 1);
+	if (drvdata->sb_irq < 0) {
+		res = drvdata->sb_irq;
+		goto err2;
+	}
 	res = devm_request_irq(&pdev->dev, drvdata->sb_irq,
 			       highbank_l2_err_handler,
 			       0, dev_name(&pdev->dev), dci);