diff mbox series

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

Message ID 20191210002041.3388-2-festevam@gmail.com
State Superseded
Delegated to: Stefano Babic
Headers show
Series [v2,1/3] wandboard: Fix the DM_PMIC conversion | expand

Commit Message

Fabio Estevam Dec. 10, 2019, 12:20 a.m. UTC
When pmic_get() or pmic_reg_read() fail, the error code should
be propagated instead of returning success.

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

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

Comments

Fabio Estevam Dec. 10, 2019, 9:31 a.m. UTC | #1
On Mon, Dec 9, 2019 at 9:20 PM Fabio Estevam <festevam@gmail.com> wrote:

> 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@8", &dev);
>         if (ret < 0) {
>                 printf("pmic_get() ret %d\n", ret);
> -               return 0;
> +               return ret;

Ops, we can't return error here because this causes issues on the
boards without PMIC.

I will resend the series without this patch.


>         }
>
>         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
>
diff mbox series

Patch

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@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;