summaryrefslogtreecommitdiff
path: root/drivers/media/cec/cec-api.c
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2017-02-27 09:18:35 -0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-03-22 11:11:46 -0300
commit059d1460cacb7e1ee499a02d92ac2b0b84d310fc (patch)
tree442911bd308be69e6b46eb14fc711d59aadb87fc /drivers/media/cec/cec-api.c
parent533a3f7bc7919f8f5462d6b921532cf1d1ccf6cd (diff)
[media] cec: return -EPERM when no LAs are configured
The CEC_TRANSMIT ioctl now returns -EPERM if an attempt is made to transmit a message for an unconfigured adapter (i.e. userspace never called CEC_ADAP_S_LOG_ADDRS). This differentiates this case from when LAs are configured, but no physical address is set. In that case -ENONET is returned. 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-api.c')
-rw-r--r--drivers/media/cec/cec-api.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/media/cec/cec-api.c b/drivers/media/cec/cec-api.c
index 627cdf7b12d1..cea350ea2a52 100644
--- a/drivers/media/cec/cec-api.c
+++ b/drivers/media/cec/cec-api.c
@@ -198,7 +198,9 @@ static long cec_transmit(struct cec_adapter *adap, struct cec_fh *fh,
return -EINVAL;
mutex_lock(&adap->lock);
- if (adap->is_configuring)
+ if (adap->log_addrs.num_log_addrs == 0)
+ err = -EPERM;
+ else if (adap->is_configuring)
err = -ENONET;
else if (!adap->is_configured && (msg.msg[0] != 0xf0 || msg.reply))
err = -ENONET;