drivers: edac: Register IRQ after all the resources are allocated

llcc ecc interrupt handler registers for interrupt and then allocates
for resources. These resources are used in the interrupt handler. So
there is small window after interrupt is registered and resources are
allocated where ecc can happen. This results into NULL pointer
exception. Avoid the race condition by moving the interrupt registration
after all the resources are allocated.

Change-Id: I26efb8c243ff155e75be837188cfc5f998400cf5
Signed-off-by: Channagoud Kadabi <ckadabi@codeaurora.org>
This commit is contained in:
Channagoud Kadabi 2017-08-31 16:34:05 -07:00
commit 31a58792f3

View file

@ -397,21 +397,6 @@ static int qcom_llcc_erp_probe(struct platform_device *pdev)
if (rc)
goto out_mem;
if (interrupt_mode) {
drv->ecc_irq = platform_get_irq_byname(pdev, "ecc_irq");
if (!drv->ecc_irq) {
rc = -ENODEV;
goto out_dev;
}
rc = devm_request_irq(dev, drv->ecc_irq, llcc_ecc_irq_handler,
IRQF_TRIGGER_HIGH, "llcc_ecc", edev_ctl);
if (rc) {
dev_err(dev, "failed to request ecc irq\n");
goto out_dev;
}
}
drv->llcc_banks = devm_kzalloc(&pdev->dev,
sizeof(u32) * drv->num_banks, GFP_KERNEL);
@ -437,6 +422,21 @@ static int qcom_llcc_erp_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, edev_ctl);
if (interrupt_mode) {
drv->ecc_irq = platform_get_irq_byname(pdev, "ecc_irq");
if (!drv->ecc_irq) {
rc = -ENODEV;
goto out_dev;
}
rc = devm_request_irq(dev, drv->ecc_irq, llcc_ecc_irq_handler,
IRQF_TRIGGER_HIGH, "llcc_ecc", edev_ctl);
if (rc) {
dev_err(dev, "failed to request ecc irq\n");
goto out_dev;
}
}
return 0;
out_dev: