Skip to content

Commit

Permalink
media: mceusb: set timeout to at least timeout provided
Browse files Browse the repository at this point in the history
By rounding down, the actual timeout can be lower than requested. As a
result, long spaces just below the requested timeout can be incorrectly
reported as timeout and truncated.

Fixes: 877f1a7 ("media: rc: mceusb: allow the timeout to be configurable")
Cc: stable@vger.kernel.org
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
  • Loading branch information
seanyoung authored and mchehab committed Sep 24, 2022
1 parent 2dfe2c4 commit 20b794d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/media/rc/mceusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@ static int mceusb_set_timeout(struct rc_dev *dev, unsigned int timeout)
struct mceusb_dev *ir = dev->priv;
unsigned int units;

units = DIV_ROUND_CLOSEST(timeout, MCE_TIME_UNIT);
units = DIV_ROUND_UP(timeout, MCE_TIME_UNIT);

cmdbuf[2] = units >> 8;
cmdbuf[3] = units;
Expand Down

0 comments on commit 20b794d

Please sign in to comment.