This is an automated email from the ASF dual-hosted git repository. jerpelea pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 14c57b077468e897fc8f75e03d9d0100b176a082 Author: SPRESENSE <41312067+sprese...@users.noreply.github.com> AuthorDate: Wed May 19 17:48:39 2021 +0900 boards: cxd56xx: Fix uninitialized variable Fix uninitialized variable. CodeSonar Warning 520074 --- boards/arm/cxd56xx/spresense/src/cxd56_power.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_power.c b/boards/arm/cxd56xx/spresense/src/cxd56_power.c index b283837..5305d8e 100644 --- a/boards/arm/cxd56xx/spresense/src/cxd56_power.c +++ b/boards/arm/cxd56xx/spresense/src/cxd56_power.c @@ -127,7 +127,8 @@ int board_pmic_write(uint8_t addr, void *buf, uint32_t size) int board_power_setup(int status) { #ifdef CONFIG_BOARD_USB_DISABLE_IN_DEEP_SLEEPING - uint8_t val; + int ret; + uint8_t val = 0; uint32_t bootcause; /* Enable USB after wakeup from deep sleeping */ @@ -140,8 +141,8 @@ int board_power_setup(int status) case PM_BOOT_DEEP_WKUPS: case PM_BOOT_DEEP_RTC: case PM_BOOT_DEEP_OTHERS: - cxd56_pmic_read(PMIC_REG_CNT_USB2, &val, sizeof(val)); - if (val & PMIC_SET_CHGOFF) + ret = cxd56_pmic_read(PMIC_REG_CNT_USB2, &val, sizeof(val)); + if ((ret == 0) && (val & PMIC_SET_CHGOFF)) { val &= ~PMIC_SET_CHGOFF; cxd56_pmic_write(PMIC_REG_CNT_USB2, &val, sizeof(val));