diff options
author | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2019-04-23 15:43:30 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2019-05-23 12:31:35 +0300 |
commit | e76cbec85eac714a93a7945c9c41dcd8819b31c5 (patch) | |
tree | 82ef3b217e246762086b07234beba1f5eedc4807 /drivers/media/cec/cec-adap.c | |
parent | 63d171f85fb15247600bdd38b1dbf72bcba0dc8a (diff) | |
download | linux-e76cbec85eac714a93a7945c9c41dcd8819b31c5.tar.xz |
media: cec: move check from cec_transmit to cec_transmit_msg_fh
This ensures all the cec_msg checks are done in the same place.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/cec/cec-adap.c')
-rw-r--r-- | drivers/media/cec/cec-adap.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/media/cec/cec-adap.c b/drivers/media/cec/cec-adap.c index b6102510e203..5b9232b6e663 100644 --- a/drivers/media/cec/cec-adap.c +++ b/drivers/media/cec/cec-adap.c @@ -761,6 +761,11 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, return -EINVAL; } + /* A CDC-Only device can only send CDC messages */ + if ((adap->log_addrs.flags & CEC_LOG_ADDRS_FL_CDC_ONLY) && + (msg->len == 1 || msg->msg[1] != CEC_MSG_CDC_MESSAGE)) + return -EINVAL; + if (msg->len >= 4 && msg->msg[1] == CEC_MSG_CDC_MESSAGE) { msg->msg[2] = adap->phys_addr >> 8; msg->msg[3] = adap->phys_addr & 0xff; |