mailbox: handle empty message in tx_tick
authorSudeep Holla <sudeep.holla@arm.com>
Tue, 21 Mar 2017 11:30:16 +0000 (11:30 +0000)
committerJassi Brar <jaswinder.singh@linaro.org>
Thu, 27 Apr 2017 10:50:04 +0000 (16:20 +0530)
We already check if the message is empty before calling the client
tx_done callback. Calling completion on a wait event is also invalid
if the message is empty.

This patch moves the existing empty message check earlier.

Fixes: 2b6d83e2b8b7 ("mailbox: Introduce framework for mailbox")
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
drivers/mailbox/mailbox.c

index 49e5dadd5733de42bff073b9c9a99d32015f01df..9dfbf7ea10a230579fbe4d102d491b045a8ea5b2 100644 (file)
@@ -103,8 +103,11 @@ static void tx_tick(struct mbox_chan *chan, int r)
        /* Submit next message */
        msg_submit(chan);
 
+       if (!mssg)
+               return;
+
        /* Notify the client */
-       if (mssg && chan->cl->tx_done)
+       if (chan->cl->tx_done)
                chan->cl->tx_done(chan->cl, mssg, r);
 
        if (r != -ETIME && chan->cl->tx_block)