mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 01:10:04 +00:00
[media] cec: improve cec_transmit_msg_fh logging
Several error paths didn't log why an error was returned. Add this. Also handle the corner case of "adapter is unconfigured AND the message is from Unregistered to TV AND reply is non-zero" separately and return EINVAL in that case, since it really is an invalid value and not an unconfigured CEC device. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
parent
5a137df1d6
commit
25c2107896
2 changed files with 14 additions and 5 deletions
|
@ -646,12 +646,21 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg,
|
|||
__func__, cec_msg_initiator(msg));
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!adap->is_configured && !adap->is_configuring &&
|
||||
(msg->msg[0] != 0xf0 || msg->reply))
|
||||
return -ENONET;
|
||||
if (!adap->is_configured && !adap->is_configuring) {
|
||||
if (msg->msg[0] != 0xf0) {
|
||||
dprintk(1, "%s: adapter is unconfigured\n", __func__);
|
||||
return -ENONET;
|
||||
}
|
||||
if (msg->reply) {
|
||||
dprintk(1, "%s: invalid msg->reply\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
if (adap->transmit_queue_sz >= CEC_MAX_MSG_TX_QUEUE_SZ)
|
||||
if (adap->transmit_queue_sz >= CEC_MAX_MSG_TX_QUEUE_SZ) {
|
||||
dprintk(1, "%s: transmit queue full\n", __func__);
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
data = kzalloc(sizeof(*data), GFP_KERNEL);
|
||||
if (!data)
|
||||
|
|
|
@ -202,7 +202,7 @@ static long cec_transmit(struct cec_adapter *adap, struct cec_fh *fh,
|
|||
err = -EPERM;
|
||||
else if (adap->is_configuring)
|
||||
err = -ENONET;
|
||||
else if (!adap->is_configured && (msg.msg[0] != 0xf0 || msg.reply))
|
||||
else if (!adap->is_configured && msg.msg[0] != 0xf0)
|
||||
err = -ENONET;
|
||||
else if (cec_is_busy(adap, fh))
|
||||
err = -EBUSY;
|
||||
|
|
Loading…
Reference in a new issue