fix(imx8ulp): fix variable may be used uninitialized error
When building with LTO, the compiler discovers that it is possible to
use the `volt` variable without writing to it. This happens when
upower_pmic_i2c_read() returns error. Check its return value and panic()
if something went wrong so the error doesn't propagate silently.
Change-Id: I46d460892a2eb24596373ad7a5b07f730a0753de
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
diff --git a/plat/imx/imx8ulp/imx8ulp_psci.c b/plat/imx/imx8ulp/imx8ulp_psci.c
index 59af8be..e67d0b5 100644
--- a/plat/imx/imx8ulp/imx8ulp_psci.c
+++ b/plat/imx/imx8ulp/imx8ulp_psci.c
@@ -289,7 +289,9 @@
/* LDO1 should be power off in PD mode */
} else if (mode == PD_PWR_MODE) {
/* overwrite the buck3 voltage setting in active mode */
- upower_pmic_i2c_read(0x22, &volt);
+ if (upower_pmic_i2c_read(0x22, &volt) != 0) {
+ panic();
+ }
pd_pmic_reg_cfgs[3].i2c_data = volt;
memcpy(&pwr_sys_cfg->ps_apd_pmic_reg_data_cfg, &pd_pmic_reg_cfgs,
sizeof(ps_apd_pmic_reg_data_cfgs_t));