diff mbox series

[5/5] edac: highbank_mc: add IRQ check

Message ID 20220126200353.14582-6-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: a1b01edb2745 ("edac: add support for Calxeda highbank memory controller")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
 drivers/edac/highbank_mc_edac.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/drivers/edac/highbank_mc_edac.c b/drivers/edac/highbank_mc_edac.c
index 61b76ec226af..36931cafcab0 100644
--- a/drivers/edac/highbank_mc_edac.c
+++ b/drivers/edac/highbank_mc_edac.c
@@ -230,6 +230,10 @@  static int highbank_mc_probe(struct platform_device *pdev)
 		goto err;
 
 	irq = platform_get_irq(pdev, 0);
+	if (irq < 0) {
+		res = irq;
+		goto err;
+	}
 	res = devm_request_irq(&pdev->dev, irq, highbank_mc_err_handler,
 			       0, dev_name(&pdev->dev), mci);
 	if (res < 0) {