summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2016-12-02 20:16:09 +0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-01-30 16:53:02 +0300
commit07e9293c188dbfff4617b0ac5bb56ad5478d33a5 (patch)
tree027ee7984613a4d4a1fd61729a32365ee55cdee7 /drivers
parentbd291208d7f5d6b2d6a033fee449a429230b06df (diff)
downloadlinux-07e9293c188dbfff4617b0ac5bb56ad5478d33a5.tar.xz
[media] lirc: LIRC_{G,S}ET_SEND_MODE fail if device cannot transmit
These ioctls should not succeed if the device cannot send. Also make it clear that these ioctls should return the lirc mode, although the actual value does not change. Signed-off-by: Sean Young <sean@mess.org> Reviewed-by: Andi Shyti <andi.shyti@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/rc/ir-lirc-codec.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c
index c3277308a70b..9e41305ad32e 100644
--- a/drivers/media/rc/ir-lirc-codec.c
+++ b/drivers/media/rc/ir-lirc-codec.c
@@ -204,11 +204,17 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd,
/* legacy support */
case LIRC_GET_SEND_MODE:
- val = LIRC_CAN_SEND_PULSE & LIRC_CAN_SEND_MASK;
+ if (!dev->tx_ir)
+ return -ENOTTY;
+
+ val = LIRC_MODE_PULSE;
break;
case LIRC_SET_SEND_MODE:
- if (val != (LIRC_MODE_PULSE & LIRC_CAN_SEND_MASK))
+ if (!dev->tx_ir)
+ return -ENOTTY;
+
+ if (val != LIRC_MODE_PULSE)
return -EINVAL;
return 0;