[media] cec: CEC_RECEIVE overwrote the timeout field
[deliverable/linux.git] / drivers / staging / media / cec / cec-api.c
index d7cba7a7d6b093174fd1fd7d0867727a8e1e2ccd..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;
                }
 
@@ -263,7 +266,7 @@ static long cec_receive(struct cec_adapter *adap, struct cec_fh *fh,
        if (copy_from_user(&msg, parg, sizeof(msg)))
                return -EFAULT;
        mutex_lock(&adap->lock);
-       if (!adap->is_configured)
+       if (!adap->is_configured && fh->mode_follower < CEC_MODE_MONITOR)
                err = -ENONET;
        mutex_unlock(&adap->lock);
        if (err)
This page took 0.036654 seconds and 5 git commands to generate.