linux/drivers/media
Hans Verkuil 9c9cb1fad8 [media] v4l2-ctrls: fix rounding calculation
Commit 958c7c7e65 ("[media] v4l2-ctrls: fix corner case in round-to-range code") broke
controls that use a negative range.

The cause was a s32/u32 mixup: ctrl->step is unsigned while all others are signed. So
the result type of the expression '(ctrl)->maximum - ((ctrl)->step / 2)' became unsigned,
making 'val >= (ctrl)->maximum - ((ctrl)->step / 2)' true, since '((u32)-128) > 128'
(if val = -128, maximum = 128 and step = 1).

So carefully cast (step / 2) to s32.

There was one cast of step to s32 where it should have been u32 because both offset and
step are unsigned, so casting to signed makes no sense there. You do need a cast to u32
there, because otherwise architectures that have no 64-bit division start complaining
(step is a u64).

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 17:51:37 -03:00
..
common [media] rc-core: remove protocol arrays 2014-07-25 19:10:43 -03:00
dvb-core [media] media: dvb-core add new flag exit flag value for resume 2014-07-26 11:20:10 -03:00
dvb-frontends [media] si2165: Add demod driver for DVB-T only 2014-07-27 17:01:41 -03:00
firewire firewire: introduce fw_driver.probe and .remove methods 2013-06-09 18:15:00 +02:00
i2c [media] rc-core: remove protocol arrays 2014-07-25 19:10:43 -03:00
mmc [media] siano: get rid of CammelCase from smscoreapi.h 2013-03-21 10:03:16 -03:00
parport [media] v4l: Support extending the v4l2_pix_format structure 2014-07-17 12:44:47 -03:00
pci [media] cx23885: Add si2165 support for HVR-5500 2014-07-27 17:01:59 -03:00
platform [media] v4l2: blackfin: select proper pinctrl state in ppi_set_params if CONFIG_PINCTRL is enabled 2014-07-26 17:15:16 -03:00
radio [media] radio-miropcm20: fix a compilation warning 2014-07-25 19:35:16 -03:00
rc [media] mceusb: select default keytable based on vendor 2014-07-27 17:37:01 -03:00
tuners [media] Kconfig: fix tuners build warnings 2014-07-25 19:30:41 -03:00
usb [media] cx231xx: handle errors at read_eeprom() 2014-07-27 17:03:51 -03:00
v4l2-core [media] v4l2-ctrls: fix rounding calculation 2014-07-27 17:51:37 -03:00
Kconfig [media] Kconfig: sub-driver auto-select SPI bus 2014-07-21 20:34:12 -03:00
Makefile
media-device.c [media] media-device: Remove duplicated memset() in media_enum_entities() 2014-07-22 01:02:52 -03:00
media-devnode.c [media] media: Use a better owner for the media device 2014-05-13 13:39:00 -03:00
media-entity.c [media] media: Check for active links on pads with MEDIA_PAD_FL_MUST_CONNECT flag 2013-12-04 15:03:45 -02:00