All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] mailbox: mediatek: Add Mediatek CMDQ driver
@ 2018-08-20 14:08 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2018-08-20 14:08 UTC (permalink / raw)
  To: houlong.wei-NuS5LvNUpcJWk0Htik3J/w
  Cc: linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Hello Houlong Wei,

The patch 623a6143a845: "mailbox: mediatek: Add Mediatek CMDQ driver"
from Jul 25, 2018, leads to the following static checker warning:

	drivers/mailbox/mtk-cmdq-mailbox.c:366 cmdq_mbox_send_data()
	error: potential null dereference 'task'.  (kzalloc returns null)

drivers/mailbox/mtk-cmdq-mailbox.c
   354  static int cmdq_mbox_send_data(struct mbox_chan *chan, void *data)
   355  {
   356          struct cmdq_pkt *pkt = (struct cmdq_pkt *)data;
   357          struct cmdq_thread *thread = (struct cmdq_thread *)chan->con_priv;
   358          struct cmdq *cmdq = dev_get_drvdata(chan->mbox->dev);
   359          struct cmdq_task *task;
   360          unsigned long curr_pa, end_pa;
   361  
   362          /* Client should not flush new tasks if suspended. */
   363          WARN_ON(cmdq->suspended);
   364  
   365          task = kzalloc(sizeof(*task), GFP_ATOMIC);
   366          task->cmdq = cmdq;

No check for kzalloc() failure.

   367          INIT_LIST_HEAD(&task->list_entry);
   368          task->pa_base = pkt->pa_base;
   369          task->thread = thread;
   370          task->pkt = pkt;
   371  
   372          if (list_empty(&thread->task_busy_list)) {
   373                  WARN_ON(clk_enable(cmdq->clock) < 0);
   374                  WARN_ON(cmdq_thread_reset(cmdq, thread) < 0);
   375  

regards,
dan carpenter

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-08-20 14:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-20 14:08 [bug report] mailbox: mediatek: Add Mediatek CMDQ driver Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.