[media] lirc: LIRC_GET_MIN_TIMEOUT should be in range
authorSean Young <sean@mess.org>
Thu, 19 Jan 2017 21:44:00 +0000 (19:44 -0200)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 31 Jan 2017 09:30:22 +0000 (07:30 -0200)
LIRC_SET_REC_TIMEOUT can fail if the value returned by
LIRC_GET_MIN_TIMEOUT is set due to rounding errors.

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 e944507fc4f5c11e3003b184f16be6bd320e5e09..8517d5153fcf211606280e5eb4c83ea4837bc4fc 100644 (file)
@@ -279,7 +279,7 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd,
        case LIRC_GET_MIN_TIMEOUT:
                if (!dev->max_timeout)
                        return -ENOSYS;
-               val = dev->min_timeout / 1000;
+               val = DIV_ROUND_UP(dev->min_timeout, 1000);
                break;
 
        case LIRC_GET_MAX_TIMEOUT: