soc/samsung/exynos5420: Refactor fimd vidtcon access
commit9904905b488cdc1e14cdae34c6040f2e9496c06f
authorJacob Garber <jgarber1@ualberta.ca>
Tue, 23 Jul 2019 00:31:30 +0000 (22 18:31 -0600)
committerPatrick Georgi <pgeorgi@google.com>
Fri, 2 Aug 2019 10:00:09 +0000 (2 10:00 +0000)
treeda60a3eac4291f077a29a121c0b0a253dc6d9faf
parentb2e75d2d1d410dd432f74e4cd46c3ee7fb9d512a
soc/samsung/exynos5420: Refactor fimd vidtcon access

Accessing the higher vidtcon variables using pointer arithmetic from the
lower address FIMD_CTRL struct is undefined behaviour, since pointers
manipulations are not allowed outside the objects they point to. The
standard-blessed way is to perform the arithmetic using integer
addresses first, and then convert that to a pointer. The end result is
the same, but avoids the risk of unsafe optimizations from an
over-zealous compiler.

Signed-off-by: Jacob Garber <jgarber1@ualberta.ca>
Found-by: Coverity CID 1402096, 1402124, 1402131, 1402169
Change-Id: I13ed23836e8e9076ae0bfd88c05c4f2badac9c49
Reviewed-on: https://review.coreboot.org/c/coreboot/+/34633
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
src/soc/samsung/exynos5420/fimd.c
src/soc/samsung/exynos5420/include/soc/dp.h
src/soc/samsung/exynos5420/include/soc/fimd.h