mailbox: mtk-cmdq: Do not request irq until we are ready

If the system comes from kexec() the peripheral might trigger an IRQ
befoe we are ready for it. Triggering a crash due to an access to
invalid memory.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
This commit is contained in:
Ricardo Ribalda 2022-11-30 13:58:22 +01:00 committed by Jassi Brar
parent a6792a0cde
commit 16edcfef77
1 changed files with 7 additions and 6 deletions

View File

@ -569,12 +569,6 @@ static int cmdq_probe(struct platform_device *pdev)
}
cmdq->irq_mask = GENMASK(cmdq->pdata->thread_nr - 1, 0);
err = devm_request_irq(dev, cmdq->irq, cmdq_irq_handler, IRQF_SHARED,
"mtk_cmdq", cmdq);
if (err < 0) {
dev_err(dev, "failed to register ISR (%d)\n", err);
return err;
}
dev_dbg(dev, "cmdq device: addr:0x%p, va:0x%p, irq:%d\n",
dev, cmdq->base, cmdq->irq);
@ -641,6 +635,13 @@ static int cmdq_probe(struct platform_device *pdev)
cmdq_init(cmdq);
err = devm_request_irq(dev, cmdq->irq, cmdq_irq_handler, IRQF_SHARED,
"mtk_cmdq", cmdq);
if (err < 0) {
dev_err(dev, "failed to register ISR (%d)\n", err);
return err;
}
return 0;
}