[PATCH v2 2/3] wandboard: Propagate the error on PMIC function failure

Fabio Estevam festevam at gmail.com
Tue Dec 10 01:20:40 CET 2019


When pmic_get() or pmic_reg_read() fail, the error code should
be propagated instead of returning success.

Signed-off-by: Fabio Estevam <festevam at gmail.com>
---
Changes since v1:
- None

 board/wandboard/wandboard.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/wandboard/wandboard.c b/board/wandboard/wandboard.c
index b2f961a7f0..7209cc8211 100644
--- a/board/wandboard/wandboard.c
+++ b/board/wandboard/wandboard.c
@@ -366,13 +366,13 @@ int power_init_board(void)
 	ret = pmic_get("pfuze100 at 8", &dev);
 	if (ret < 0) {
 		printf("pmic_get() ret %d\n", ret);
-		return 0;
+		return ret;
 	}
 
 	reg = pmic_reg_read(dev, PFUZE100_DEVICEID);
 	if (reg < 0) {
 		printf("pmic_reg_read() ret %d\n", reg);
-		return 0;
+		return ret;
 	}
 	printf("PMIC:  PFUZE100 ID=0x%02x\n", reg);
 	with_pmic = true;
-- 
2.17.1



More information about the U-Boot mailing list