Skip to content

Commit 16edcfe

Browse files
ribaldaJassiBrar
authored andcommitted
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 <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Reviewed-by: Chun-Kuang Hu <[email protected]> Signed-off-by: Jassi Brar <[email protected]>
1 parent a6792a0 commit 16edcfe

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

drivers/mailbox/mtk-cmdq-mailbox.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -569,12 +569,6 @@ static int cmdq_probe(struct platform_device *pdev)
569569
}
570570

571571
cmdq->irq_mask = GENMASK(cmdq->pdata->thread_nr - 1, 0);
572-
err = devm_request_irq(dev, cmdq->irq, cmdq_irq_handler, IRQF_SHARED,
573-
"mtk_cmdq", cmdq);
574-
if (err < 0) {
575-
dev_err(dev, "failed to register ISR (%d)\n", err);
576-
return err;
577-
}
578572

579573
dev_dbg(dev, "cmdq device: addr:0x%p, va:0x%p, irq:%d\n",
580574
dev, cmdq->base, cmdq->irq);
@@ -641,6 +635,13 @@ static int cmdq_probe(struct platform_device *pdev)
641635

642636
cmdq_init(cmdq);
643637

638+
err = devm_request_irq(dev, cmdq->irq, cmdq_irq_handler, IRQF_SHARED,
639+
"mtk_cmdq", cmdq);
640+
if (err < 0) {
641+
dev_err(dev, "failed to register ISR (%d)\n", err);
642+
return err;
643+
}
644+
644645
return 0;
645646
}
646647

0 commit comments

Comments
 (0)