@@ -353,9 +353,6 @@ static int altr_sdram_probe(struct platform_device *pdev)
return -ENODEV;
}
- /* Arria10 has a 2nd IRQ */
- irq2 = platform_get_irq(pdev, 1);
-
layers[0].type = EDAC_MC_LAYER_CHIP_SELECT;
layers[0].size = 1;
layers[0].is_virt_csrow = true;
@@ -406,6 +403,12 @@ static int altr_sdram_probe(struct platform_device *pdev)
if (res < 0)
goto err2;
+ /* Arria10 has a 2nd IRQ */
+ irq2 = platform_get_irq(pdev, 1);
+ if (irq2 < 0) {
+ res = irq2;
+ goto err2;
+ }
res = devm_request_irq(&pdev->dev, irq2,
altr_sdram_mc_err_handler,
IRQF_SHARED, dev_name(&pdev->dev), mci);
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. While at it, move the call to platform_get_irq() to the place where it makes more sense... Fixes: 73bcc942f427 ("EDAC, altera: Add Arria10 EDAC support") Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru> --- drivers/edac/altera_edac.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)