summaryrefslogtreecommitdiff
path: root/drivers/media/cec/cec-adap.c
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2017-02-27 10:54:09 -0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-03-22 11:14:45 -0300
commit25c2107896c5094318f04af8f975266e57d15528 (patch)
treea01d995bf32868b71a0707bad5532ea42a055e3a /drivers/media/cec/cec-adap.c
parent5a137df1d6570de438ce12f33d6b4308b5e965fb (diff)
[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>
Diffstat (limited to 'drivers/media/cec/cec-adap.c')
-rw-r--r--drivers/media/cec/cec-adap.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/media/cec/cec-adap.c b/drivers/media/cec/cec-adap.c
index 4f1e571d10b7..9e25ba20f4d1 100644
--- a/drivers/media/cec/cec-adap.c
+++ b/drivers/media/cec/cec-adap.c
@@ -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)