From 9904905b488cdc1e14cdae34c6040f2e9496c06f Mon Sep 17 00:00:00 2001 From: Jacob Garber Date: Mon, 22 Jul 2019 18:31:30 -0600 Subject: 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 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) Reviewed-by: Julius Werner --- src/soc/samsung/exynos5420/include/soc/dp.h | 5 ----- src/soc/samsung/exynos5420/include/soc/fimd.h | 3 ++- 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'src/soc/samsung/exynos5420/include') diff --git a/src/soc/samsung/exynos5420/include/soc/dp.h b/src/soc/samsung/exynos5420/include/soc/dp.h index 28db73a019..6b33a76294 100644 --- a/src/soc/samsung/exynos5420/include/soc/dp.h +++ b/src/soc/samsung/exynos5420/include/soc/dp.h @@ -884,11 +884,6 @@ struct exynos_fb { /* LCD IF register offset */ #define EXYNOS5_LCD_IF_BASE_OFFSET 0x20000 -static inline u32 exynos_fimd_get_base_offset(void) -{ - return EXYNOS5_LCD_IF_BASE_OFFSET/4; -} - /* * Register offsets */ diff --git a/src/soc/samsung/exynos5420/include/soc/fimd.h b/src/soc/samsung/exynos5420/include/soc/fimd.h index d9d86cbfae..3e9d6a44f5 100644 --- a/src/soc/samsung/exynos5420/include/soc/fimd.h +++ b/src/soc/samsung/exynos5420/include/soc/fimd.h @@ -136,7 +136,8 @@ check_member(exynos5_disp_ctrl, trigcon, 0x1a4); #define OSD_RIGHTBOTX_F_OFFSET 11 #define OSD_RIGHTBOTY_F_OFFSET 0 -#define FIMD_CTRL ((struct exynos_fb *)0x14400000) +#define FIMD_CTRL_ADDR 0x14400000 +#define FIMD_CTRL ((struct exynos_fb *)FIMD_CTRL_ADDR) /* from u-boot fb.h. It needs to be merged with these dp structs maybe. */ enum { -- cgit v1.2.3