Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 31a58792 authored by Channagoud Kadabi's avatar Channagoud Kadabi
Browse files

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: default avatarChannagoud Kadabi <ckadabi@codeaurora.org>
parent 5a186617
Loading
Loading
Loading
Loading
+15 −15
Original line number Diff line number Diff line
@@ -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: