diff mbox

[2/3] cec: remove WARN_ON

Message ID 1462950688-23290-3-git-send-email-hverkuil@xs4all.nl (mailing list archive)
State New, archived
Headers show

Commit Message

Hans Verkuil May 11, 2016, 7:11 a.m. UTC
From: Hans Verkuil <hans.verkuil@cisco.com>

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 <hans.verkuil@cisco.com>
---
 drivers/staging/media/cec/cec.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
diff mbox

Patch

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;
 	}