]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
[media] lirc: return ENOTTY when device does support ioctl
authorSean Young <sean@mess.org>
Wed, 8 Feb 2017 22:44:38 +0000 (20:44 -0200)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Fri, 24 Mar 2017 11:20:28 +0000 (08:20 -0300)
If timeouts or carrier range is not supported, return proper error.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/rc/ir-lirc-codec.c

index 637b583963e39b59197e968aa464484898c4f16d..235d74adc3fd1022c53e3d47cd0e473c8aa64168 100644 (file)
@@ -253,6 +253,9 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd,
                                               val);
 
        case LIRC_SET_REC_CARRIER_RANGE:
+               if (!dev->s_rx_carrier_range)
+                       return -ENOTTY;
+
                if (val <= 0)
                        return -EINVAL;
 
@@ -305,6 +308,9 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd,
                break;
 
        case LIRC_SET_REC_TIMEOUT_REPORTS:
+               if (!dev->timeout)
+                       return -ENOTTY;
+
                lirc->send_timeout_reports = !!val;
                break;