]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] cec: CEC_RECEIVE overwrote the timeout field
authorHans Verkuil <hans.verkuil@cisco.com>
Sat, 16 Jul 2016 10:58:31 +0000 (07:58 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 19 Jul 2016 16:21:34 +0000 (13:21 -0300)
When CEC_RECEIVE returns a message the original timeout field
was overwritten. Restore the timeout field.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/staging/media/cec/cec-api.c

index 9151b1fa18dc78e23a977c0c67a21f30fdcac506..879f7d96e1a7c58225f3901713679878df645824 100644 (file)
@@ -209,6 +209,7 @@ static long cec_transmit(struct cec_adapter *adap, struct cec_fh *fh,
 /* Called by CEC_RECEIVE: wait for a message to arrive */
 static int cec_receive_msg(struct cec_fh *fh, struct cec_msg *msg, bool block)
 {
+       u32 timeout = msg->timeout;
        int res;
 
        do {
@@ -225,6 +226,8 @@ static int cec_receive_msg(struct cec_fh *fh, struct cec_msg *msg, bool block)
                        kfree(entry);
                        fh->queued_msgs--;
                        mutex_unlock(&fh->lock);
+                       /* restore original timeout value */
+                       msg->timeout = timeout;
                        return 0;
                }