From patchwork Wed May 11 07:11:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 9065551 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8DEB89F6FA for ; Wed, 11 May 2016 07:11:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B898120154 for ; Wed, 11 May 2016 07:11:45 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 0B60020172 for ; Wed, 11 May 2016 07:11:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 21D4B6E6ED; Wed, 11 May 2016 07:11:42 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lb3-smtp-cloud6.xs4all.net (lb3-smtp-cloud6.xs4all.net [194.109.24.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2F8116E6ED for ; Wed, 11 May 2016 07:11:40 +0000 (UTC) Received: from tschai.lan ([90.149.38.145]) by smtp-cloud6.xs4all.net with ESMTP id svBZ1s00T37uBN201vBfm3; Wed, 11 May 2016 09:11:39 +0200 Received: from tschai.fritz.box (localhost [127.0.0.1]) by tschai.lan (Postfix) with ESMTPSA id E091E180D39; Wed, 11 May 2016 09:11:28 +0200 (CEST) From: Hans Verkuil To: linux-media@vger.kernel.org Subject: [PATCH 2/3] cec: remove WARN_ON Date: Wed, 11 May 2016 09:11:27 +0200 Message-Id: <1462950688-23290-3-git-send-email-hverkuil@xs4all.nl> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1462950688-23290-1-git-send-email-hverkuil@xs4all.nl> References: <1462950688-23290-1-git-send-email-hverkuil@xs4all.nl> Cc: Hans Verkuil , dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Hans Verkuil If a transmit is issued and before cec_transmit_done() is called the HDMI cable is unplugged, then it is possible that adap->transmitting == NULL. So drop the WARN_ON, explain why it can happen and just ignore the tranmit. Signed-off-by: Hans Verkuil --- drivers/staging/media/cec/cec.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/staging/media/cec/cec.c b/drivers/staging/media/cec/cec.c index 3c5f084..9a62aa2 100644 --- a/drivers/staging/media/cec/cec.c +++ b/drivers/staging/media/cec/cec.c @@ -485,9 +485,13 @@ void cec_transmit_done(struct cec_adapter *adap, u8 status, u8 arb_lost_cnt, dprintk(2, "cec_transmit_done %02x\n", status); mutex_lock(&adap->lock); data = adap->transmitting; - if (WARN_ON(data == NULL)) { - /* This is weird and should not happen. Ignore this transmit */ - dprintk(0, "cec_transmit_done without an ongoing transmit!\n"); + if (data == NULL) { + /* + * This can happen if a transmit was issued and the cable is + * unplugged while the transmit is ongoing. Ignore this + * transmit in that case. + */ + dprintk(1, "cec_transmit_done without an ongoing transmit!\n"); goto unlock; }