media: cedrus: Fix undefined shift with a SHIFT_AND_MASK_BITS macro
authorPaul Kocialkowski <paul.kocialkowski@bootlin.com>
Tue, 22 Oct 2019 15:26:50 +0000 (12:26 -0300)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Thu, 24 Oct 2019 21:07:34 +0000 (18:07 -0300)
commit06eff2150d4db991ca236f3d05a9dc0101475aea
tree1eb187edabb291c93e840b11127f90867a3f30d4
parent746facd39370cc10038eba695f37269c6a401fda
media: cedrus: Fix undefined shift with a SHIFT_AND_MASK_BITS macro

We need to shift and mask values at different occasions to fill up
cedrus registers. This was done using macros that don't explicitly
treat arguments as unsigned, leading to possibly undefined behavior.

Introduce the SHIFT_AND_MASK_BITS macro and use it where possible.
In cases where it doesn't apply as-is, explicitly cast to unsigned
instead.

This macro should be moved to include/linux/bits.h eventually.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/staging/media/sunxi/cedrus/cedrus_regs.h