diff options
author | Bitan Biswas <bbiswas@nvidia.com> | 2019-06-14 12:31:01 -0400 |
---|---|---|
committer | Jassi Brar <jaswinder.singh@linaro.org> | 2019-07-11 00:08:44 -0400 |
commit | 20b5d24c7669813ec73589146f7dcefbf259a26a (patch) | |
tree | 90da1fd417572b74831dc7f7ef1e489fca463c3a | |
parent | b1a399530ca9bc958ac48fe85837c791f89a3be2 (diff) |
mailbox: tegra: avoid resume NULL mailboxes
If Tegra HSP device tree does not have 'shared irqs',
mailboxes pointer is NULL. Add non-NULL HSP mailboxes
check in resume callback before tegra_hsp_mailbox_startup()
call and prevent NULL pointer exception.
Signed-off-by: Bitan Biswas <bbiswas@nvidia.com>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
-rw-r--r-- | drivers/mailbox/tegra-hsp.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/mailbox/tegra-hsp.c b/drivers/mailbox/tegra-hsp.c index 91e223e05e1d..4c5ba35d48d4 100644 --- a/drivers/mailbox/tegra-hsp.c +++ b/drivers/mailbox/tegra-hsp.c | |||
@@ -782,11 +782,13 @@ static int __maybe_unused tegra_hsp_resume(struct device *dev) | |||
782 | tegra_hsp_doorbell_startup(db->channel.chan); | 782 | tegra_hsp_doorbell_startup(db->channel.chan); |
783 | } | 783 | } |
784 | 784 | ||
785 | for (i = 0; i < hsp->num_sm; i++) { | 785 | if (hsp->mailboxes) { |
786 | struct tegra_hsp_mailbox *mb = &hsp->mailboxes[i]; | 786 | for (i = 0; i < hsp->num_sm; i++) { |
787 | struct tegra_hsp_mailbox *mb = &hsp->mailboxes[i]; | ||
787 | 788 | ||
788 | if (mb->channel.chan->cl) | 789 | if (mb->channel.chan->cl) |
789 | tegra_hsp_mailbox_startup(mb->channel.chan); | 790 | tegra_hsp_mailbox_startup(mb->channel.chan); |
791 | } | ||
790 | } | 792 | } |
791 | 793 | ||
792 | return 0; | 794 | return 0; |