Skip to content

Commit

Permalink
mailbox: tegra: avoid resume NULL mailboxes
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Bitan Biswas authored and Jassi Brar committed Jul 11, 2019
1 parent b1a3995 commit 20b5d24
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions drivers/mailbox/tegra-hsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -782,11 +782,13 @@ static int __maybe_unused tegra_hsp_resume(struct device *dev)
tegra_hsp_doorbell_startup(db->channel.chan);
}

for (i = 0; i < hsp->num_sm; i++) {
struct tegra_hsp_mailbox *mb = &hsp->mailboxes[i];
if (hsp->mailboxes) {
for (i = 0; i < hsp->num_sm; i++) {
struct tegra_hsp_mailbox *mb = &hsp->mailboxes[i];

if (mb->channel.chan->cl)
tegra_hsp_mailbox_startup(mb->channel.chan);
if (mb->channel.chan->cl)
tegra_hsp_mailbox_startup(mb->channel.chan);
}
}

return 0;
Expand Down

0 comments on commit 20b5d24

Please sign in to comment.