summaryrefslogtreecommitdiff
path: root/drivers/mailbox/mtk-cmdq-mailbox.c
diff options
context:
space:
mode:
authorRicardo Ribalda <ribalda@chromium.org>2022-11-30 15:58:22 +0300
committerJassi Brar <jaswinder.singh@linaro.org>2022-12-19 05:40:31 +0300
commit16edcfef77147748c43c9c58ce18f59c61d1c357 (patch)
tree97a89d1f6f6401a65e3fc5c0e973b0638bac9bac /drivers/mailbox/mtk-cmdq-mailbox.c
parenta6792a0cdef0b1c2d77920246283a72537e60e94 (diff)
downloadlinux-16edcfef77147748c43c9c58ce18f59c61d1c357.tar.xz
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>
Diffstat (limited to 'drivers/mailbox/mtk-cmdq-mailbox.c')
-rw-r--r--drivers/mailbox/mtk-cmdq-mailbox.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c
index a460ee26eb11..b18d47ea13a0 100644
--- a/drivers/mailbox/mtk-cmdq-mailbox.c
+++ b/drivers/mailbox/mtk-cmdq-mailbox.c
@@ -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;
}