mailbox: bcm2835: Fix of_xlate return value
authorStefan Wahren <stefan.wahren@i2se.com>
Sat, 26 May 2018 10:24:00 +0000 (12:24 +0200)
committerJassi Brar <jaswinder.singh@linaro.org>
Wed, 6 Jun 2018 16:51:59 +0000 (22:21 +0530)
The bcm2835-mailbox returns NULL instead of an error pointer, which could
result in a NULL ptr dereference in mbox_request_channel. So fix this
by returning a proper error pointer.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Fixes: 0bae6af6d704 ("mailbox: Enable BCM2835 mailbox support")
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
drivers/mailbox/bcm2835-mailbox.c

index cfb4b4496dd9f61362dea012176c146120fada07..e92bbc533821ad9877316bab29672ec05c266ac5 100644 (file)
@@ -134,7 +134,7 @@ static struct mbox_chan *bcm2835_mbox_index_xlate(struct mbox_controller *mbox,
                    const struct of_phandle_args *sp)
 {
        if (sp->args_count != 0)
-               return NULL;
+               return ERR_PTR(-EINVAL);
 
        return &mbox->chans[0];
 }