[PATCH 4/9] cec: return -EPERM when no LAs are configured

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Hans Verkuil <hans.verkuil@xxxxxxxxx>

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@xxxxxxxxx>
---
 drivers/media/cec/cec-api.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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;
-- 
2.11.0




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux