mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 21:10:51 +07:00
mailbox: check ->last_tx_done for NULL in case of timer-based polling
It is allowed by code to register mailbox controller that sets txdone_poll flag to request timer-based polling with missed ->last_tx_done() method. If such thing happens and since presence of last_tx_done() is not checked it will fail in hrtimer callback function txdone_hrtimer() when first message will be transmitted. This patch adds check for this method and logging of error on registration of mailbox controller if it requested timer-based polling. Signed-off-by: Alexey Klimov <alexey.klimov@arm.com> Acked-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
This commit is contained in:
parent
dd32fae072
commit
4605fff00b
@ -453,6 +453,12 @@ int mbox_controller_register(struct mbox_controller *mbox)
|
|||||||
txdone = TXDONE_BY_ACK;
|
txdone = TXDONE_BY_ACK;
|
||||||
|
|
||||||
if (txdone == TXDONE_BY_POLL) {
|
if (txdone == TXDONE_BY_POLL) {
|
||||||
|
|
||||||
|
if (!mbox->ops->last_tx_done) {
|
||||||
|
dev_err(mbox->dev, "last_tx_done method is absent\n");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
hrtimer_init(&mbox->poll_hrt, CLOCK_MONOTONIC,
|
hrtimer_init(&mbox->poll_hrt, CLOCK_MONOTONIC,
|
||||||
HRTIMER_MODE_REL);
|
HRTIMER_MODE_REL);
|
||||||
mbox->poll_hrt.function = txdone_hrtimer;
|
mbox->poll_hrt.function = txdone_hrtimer;
|
||||||
|
Loading…
Reference in New Issue
Block a user