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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 31 Dec 2019 15:44:15 +0000 (16:44 +0100)
commitce9071fa5a0984f97723b608030c020eb0ae4b1b
tree1abc073ebbd321bc2d82eb68d6d1733ce3e6966e
parent0f88da95b10a291ec972a6920210e63ff94947f8
media: cedrus: Fix undefined shift with a SHIFT_AND_MASK_BITS macro

[ Upstream commit 06eff2150d4db991ca236f3d05a9dc0101475aea ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/staging/media/sunxi/cedrus/cedrus_regs.h