Commit c1aad755 authored by Wolfram Sang's avatar Wolfram Sang Committed by Jassi Brar
Browse files

mailbox: add sanity check for channel array



Fail gracefully if there is no channel array attached to the mailbox
controller. Otherwise the later dereference will cause an OOPS which
might not be seen because mailbox controllers might instantiate very
early. Remove the comment explaining the obvious while here.

Fixes: 2b6d83e2 ("mailbox: Introduce framework for mailbox")
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: default avatarJassi Brar <jassisinghbrar@gmail.com>
parent c02053a9
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -526,8 +526,7 @@ int mbox_controller_register(struct mbox_controller *mbox)
{
	int i, txdone;

	/* Sanity check */
	if (!mbox || !mbox->dev || !mbox->ops || !mbox->num_chans)
	if (!mbox || !mbox->dev || !mbox->ops || !mbox->chans || !mbox->num_chans)
		return -EINVAL;

	if (mbox->txdone_irq)