Commit 9f0a0a38 authored by Houlong Wei's avatar Houlong Wei Committed by Jassi Brar

mailbox: mediatek: Add check for possible failure of kzalloc

The patch 623a6143("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: 623a6143 ("mailbox: mediatek: Add Mediatek CMDQ driver")
Reported-by: default avatarDan Carpenter <>
Signed-off-by: default avatarHoulong Wei <>
Reviewed-by: default avatarPhilipp Zabel <>
Signed-off-by: default avatarJassi Brar <>
parent 462f668e
......@@ -363,6 +363,9 @@ static int cmdq_mbox_send_data(struct mbox_chan *chan, void *data)
task = kzalloc(sizeof(*task), GFP_ATOMIC);
if (!task)
return -ENOMEM;
task->cmdq = cmdq;
task->pa_base = pkt->pa_base;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment