]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit - drivers/media/dvb-core/dvb_frontend.c
[media] fix dvb_frontend_sleep_until() logic
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>
Wed, 18 Nov 2015 14:55:47 +0000 (12:55 -0200)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Thu, 19 Nov 2015 13:57:08 +0000 (11:57 -0200)
commita733a41a5057b47ed4a1f43d33166770ef83bc10
treece7dd1325c8ade1f51dcfeb1d9a9ab2e2aa01dad
parent439be34800f8588503059434ce873ff84fcb00c3
[media] fix dvb_frontend_sleep_until() logic

As pointed by Laurent Navet:
"Calling ktime_add_us() seems useless as is only useful
 for it's return value which is ignored."

That's reported by coverity CID 1309761.

Laurent proposed to just remove ktime_add_us, but the fact is that
the logic of this function is broken. Instead, we need to use the
value of the timeout, and ensure that it will work on the loops
to emulate the legacy DiSEqC ioctl (FE_DISHNETWORK_SEND_LEGACY_CMD).

Please notice that the logic was also broken if, for any reason,
msleep() would sleep a little less than what it was expected, as
newdelta would be smaller than delta, and udelay() would not be called.

It should also be noticed that nobody noticed that trouble before
likely because the FE_DISHNETWORK_SEND_LEGACY_CMD is not used
anymore by modern DVB applications.

Reported-by: Laurent Navet <laurent.navet@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/dvb-core/dvb_frontend.c