From patchwork Tue Jul 25 20:07:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 108694 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp14558obm; Tue, 25 Jul 2017 13:08:08 -0700 (PDT) X-Received: by 10.84.131.6 with SMTP id 6mr22575972pld.413.1501013288008; Tue, 25 Jul 2017 13:08:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501013288; cv=none; d=google.com; s=arc-20160816; b=dqHX2Y92fBBz5dFSpu+u1jk3yUb/ONufd/5gpV736rCVaG6iGnuRM8pzHUIEwOfnxK RL+S7u4355kRuvuOlVZWEZGhPkNiAfYjdoY5R+L5QHSOlJFBbtwAswRCd+XoNkFjZ6Fk zew35jnfMCQzb7NQN8E26X8qi7dIoPbaOGzzL9E5Q0shsf6mAbOsz9jSnI3wbgkANu36 FeDrb3k5DmejS8oLIyqsyfAaDswRocywhs6AbG6MJMAX6sHrxBgTcs8f7fSOMYTsgQxL PLHY/ABDZ6zJWIjDzvv3T1vmYxz4Chager7rG+22fOe6KIlkEkHdW5VXsp5nAjFYf+2V ACgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=iKHwY+OI4PFUdYPlXB4zk1TJKjY4YwqlBxWMoMS/jgk=; b=bE/fHj/j4/QYtxIT69Pnjpnwb/fjs8wDxtoH+Qdm1QGOShjMzSBwI2FRD4oRfY5XGN 8+eOd+sUlc2w5cqqzlPqFdNEwhVttwdtr0McmH+Wr5HjCcoTVZf41HoLqLIfMyH+fP2Y IYeye5LDcvqLZxqJNORquMB65ng+YGIFVgc7qOInQyZ9FSVAcC86vaeB9ShQMsMho+kU FzfXnr9LMGudWBduV74xXnLW2nuGolYD4LaQ7IAYTLOapSK/sC25v1fFuugYluoz9wq4 Mr3WH249gN3NRQQ87IyniMw9zH5EuxQMxpoRZdZXqHQ4WmbkgN6bDlyZhTOH6pa9QAAq tyyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=hwX2G9f5; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h10si8970990plk.237.2017.07.25.13.08.05; Tue, 25 Jul 2017 13:08:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=hwX2G9f5; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753445AbdGYUID (ORCPT + 6 others); Tue, 25 Jul 2017 16:08:03 -0400 Received: from mail-pg0-f53.google.com ([74.125.83.53]:36972 "EHLO mail-pg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753276AbdGYUIC (ORCPT ); Tue, 25 Jul 2017 16:08:02 -0400 Received: by mail-pg0-f53.google.com with SMTP id y129so74391735pgy.4 for ; Tue, 25 Jul 2017 13:08:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=iKHwY+OI4PFUdYPlXB4zk1TJKjY4YwqlBxWMoMS/jgk=; b=hwX2G9f57n59PwQJZkkXqi6tNlcQPispoj8g86h2ZXDiFHX1KKifzQKTdr6CyG6+6V q476pHplhxktfK7WivdQbGcShz6JcB8rpih2t8uUN3KHQ2Uvog5GyQbKiHJIQ8lqeqU3 9ZcjicktOqeYYdD9q/XXRCpkTAxpTolBeWUZg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=iKHwY+OI4PFUdYPlXB4zk1TJKjY4YwqlBxWMoMS/jgk=; b=acuiI6z/x0hkyyiCkAvvvL/Sn6Y4b7uALKyFnr1iPTPh3cOqY1I2ktKgd2bxOCeal+ G5ANmjxh3neJCeqaFFPKMLFR89AWlWhsA/VDBvMhh1mNDhNsNFuMj1CzM8N+ikIXoKWV g5XG2vnKG6Kf0X753BpwNKPmFCKZZ0wsyNDCi9U7CC6WCkC1zXyilQ24+Q8xpH32RClX p0zNU4x0uEgC9bgo72zpikUod24ZVL9SyeWUFQlh5PQrcOC5XChNO2OA/IOA0ka3xINk /3Ew8ahB0IoSNJDruyS5tMGBOYPSObv06IIRl2HuPXcMyLQiI6I2eBlM/B13n6MJj9oV 4jOw== X-Gm-Message-State: AIVw112TAA/m2cauWN4Mdau2vPQ0Sqq9YGL6aHCC2Dm3k5sk0RCHh3Za fEIAWsK4z0wUaqIIrpHqJw== X-Received: by 10.98.89.22 with SMTP id n22mr20643268pfb.326.1501013281722; Tue, 25 Jul 2017 13:08:01 -0700 (PDT) Received: from localhost.localdomain ([106.51.135.235]) by smtp.gmail.com with ESMTPSA id c76sm27684356pfj.91.2017.07.25.13.07.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Jul 2017 13:08:00 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , Sudeep Holla , Jassi Brar Subject: [PATCH for-4.4 12/13] mailbox: handle empty message in tx_tick Date: Wed, 26 Jul 2017 01:37:20 +0530 Message-Id: <1501013241-31961-13-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501013241-31961-1-git-send-email-amit.pundir@linaro.org> References: <1501013241-31961-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Sudeep Holla commit cb710ab1d8a23f68ff8f45aedf3e552bb90e70de upstream. 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 Signed-off-by: Jassi Brar Signed-off-by: Amit Pundir --- drivers/mailbox/mailbox.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c index 233af2ce9b8c..9cf826df89b1 100644 --- a/drivers/mailbox/mailbox.c +++ b/drivers/mailbox/mailbox.c @@ -104,8 +104,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)