From: Hans Verkuil <hans.verk...@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 at cisco.com>
---
 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;
        }

-- 
2.8.1

Reply via email to