From 9d1a5bafd06aaf3fceda7138e6b5be1a64de2e45 Mon Sep 17 00:00:00 2001 From: Robby Cai <robby.cai@nxp.com> Date: Mon, 6 Sep 2021 15:31:02 +0800 Subject: [PATCH] LF-4297 Fix Coverity Issue:17320543 Uninitialized scalar variable The variable 'ext_temp' presenting the external temperature is expected to be used when call with DEFAULT_TEMP_INDEX and overridden by new value if read out successfully from the PMIC. For some reason sometimes the temperature value from PMIC is not correct on MX8ULP (e.g., read out as '0'), disable it temporarily. As a consequence, it causes the variable 'ext_temp' might be uninitialized and then set a wrong temperature index to register. This patch fixed this Uninitialized problem by setting to DEFAULT_TEMP. Current logic is the driver will use DEFAULT_TEMP unless the user assigns different value. To revisit PMIC temperature driver to restore previous logic. Signed-off-by: Robby Cai <robby.cai@nxp.com> Acked-by: Jason Liu <jason.hui.liu@nxp.com> --- drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c b/drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c index d1beddc8f7ce8f..19ddf3d0b83abf 100644 --- a/drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c +++ b/drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c @@ -804,7 +804,7 @@ static inline void epdc_set_temp(u32 temp) { int ret = 0; /* used to store external panel temperature value */ - unsigned int ext_temp, ext_temp_index = temp; + unsigned int ext_temp = DEFAULT_TEMP, ext_temp_index = temp; if (temp == DEFAULT_TEMP_INDEX) { /*ret = max17135_reg_read(REG_MAX17135_EXT_TEMP, &ext_temp);*/ -- GitLab