diff options
author | Houlong Wei <houlong.wei@mediatek.com> | 2018-08-21 18:22:44 +0800 |
---|---|---|
committer | Jassi Brar <jaswinder.singh@linaro.org> | 2018-09-29 12:42:39 +0530 |
commit | 9f0a0a381c5db56e7922dbeea6831f27db58372f (patch) | |
tree | 73984996edf075d6ab8a080139ae5ad63b864370 /drivers/mailbox | |
parent | 462f668e5c87e653a04de08e1de9a9ea86000164 (diff) | |
download | linux-stable-9f0a0a381c5db56e7922dbeea6831f27db58372f.tar.gz linux-stable-9f0a0a381c5db56e7922dbeea6831f27db58372f.tar.bz2 linux-stable-9f0a0a381c5db56e7922dbeea6831f27db58372f.zip |
mailbox: mediatek: Add check for possible failure of kzalloc
The patch 623a6143a845("mailbox: mediatek: Add Mediatek CMDQ driver")
introduce the following static checker warning:
drivers/mailbox/mtk-cmdq-mailbox.c:366 cmdq_mbox_send_data()
error: potential null dereference 'task'. (kzalloc returns null)
Fixes: 623a6143a845 ("mailbox: mediatek: Add Mediatek CMDQ driver")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Houlong Wei <houlong.wei@mediatek.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
Diffstat (limited to 'drivers/mailbox')
-rw-r--r-- | drivers/mailbox/mtk-cmdq-mailbox.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c index aec46d5d3506..f7cc29c00302 100644 --- a/drivers/mailbox/mtk-cmdq-mailbox.c +++ b/drivers/mailbox/mtk-cmdq-mailbox.c @@ -363,6 +363,9 @@ static int cmdq_mbox_send_data(struct mbox_chan *chan, void *data) WARN_ON(cmdq->suspended); task = kzalloc(sizeof(*task), GFP_ATOMIC); + if (!task) + return -ENOMEM; + task->cmdq = cmdq; INIT_LIST_HEAD(&task->list_entry); task->pa_base = pkt->pa_base; |