Commit 4eef404f authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] cec: don't set fh to NULL in CEC_TRANSMIT

The filehandle was set to NULL when in non-blocking mode or when
no reply is needed.

This is wrong: the filehandle is needed in non-blocking mode to ensure
that the result of the transmit can be obtained through CEC_RECEIVE.

And the 'reply' check was also incorrect since it should have checked the
timeout field (the reply can be 0). In any case, when in blocking mode
there is no need to set the fh to NULL either.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 40df3a7e
......@@ -189,15 +189,12 @@ static long cec_transmit(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)
err = -ENONET;
} else if (cec_is_busy(adap, fh)) {
else if (cec_is_busy(adap, fh))
err = -EBUSY;
} else {
if (!block || !msg.reply)
fh = NULL;
else
err = cec_transmit_msg_fh(adap, &msg, fh, block);
}
mutex_unlock(&adap->lock);
if (err)
return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment