Skip to content

Commit

Permalink
mailbox: mtk-cmdq: Do not request irq until we are ready
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ricardo Ribalda authored and Jassi Brar committed Dec 19, 2022
1 parent a6792a0 commit 16edcfe
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions drivers/mailbox/mtk-cmdq-mailbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 16edcfe

Please sign in to comment.