diff options
author | Alexey Klimov <alexey.klimov@arm.com> | 2017-03-21 12:57:34 -0400 |
---|---|---|
committer | Jassi Brar <jaswinder.singh@linaro.org> | 2017-03-28 14:22:02 -0400 |
commit | 4605fff00b886657835a58ef3cf2377356029e55 (patch) | |
tree | f98454c954b19a104dff9c87dacac3e35711c0f2 | |
parent | dd32fae0722ddd1235342a4b0c00f91a14b2742c (diff) |
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>
-rw-r--r-- | drivers/mailbox/mailbox.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c index 4671f8a12872..59b722177bf7 100644 --- a/drivers/mailbox/mailbox.c +++ b/drivers/mailbox/mailbox.c | |||
@@ -453,6 +453,12 @@ int mbox_controller_register(struct mbox_controller *mbox) | |||
453 | txdone = TXDONE_BY_ACK; | 453 | txdone = TXDONE_BY_ACK; |
454 | 454 | ||
455 | if (txdone == TXDONE_BY_POLL) { | 455 | if (txdone == TXDONE_BY_POLL) { |
456 | |||
457 | if (!mbox->ops->last_tx_done) { | ||
458 | dev_err(mbox->dev, "last_tx_done method is absent\n"); | ||
459 | return -EINVAL; | ||
460 | } | ||
461 | |||
456 | hrtimer_init(&mbox->poll_hrt, CLOCK_MONOTONIC, | 462 | hrtimer_init(&mbox->poll_hrt, CLOCK_MONOTONIC, |
457 | HRTIMER_MODE_REL); | 463 | HRTIMER_MODE_REL); |
458 | mbox->poll_hrt.function = txdone_hrtimer; | 464 | mbox->poll_hrt.function = txdone_hrtimer; |