diff options
author | Caveh Jalali <caveh@chromium.org> | 2022-11-02 20:34:43 -0700 |
---|---|---|
committer | Martin L Roth <gaumless@gmail.com> | 2022-11-12 22:59:28 +0000 |
commit | 0bab8ed085a92b7c8119d178e1f14a4736eafd60 (patch) | |
tree | 782aef2b9a861c68ab99704786bc4cc40c279af8 /src/ec | |
parent | 60293e9b1f4cec45c28d7de3aa42e35faebe4b99 (diff) |
ec/google/chromeec: Simplify get_uptime_info error handling
google_chromeec_get_uptime_info() doesn't need to return an error code
from the lower level calls for the caller to interpret. It is more
appropriate to return a success/failure boolean.
BUG=b:258126464
BRANCH=none
TEST=none
Change-Id: I3e27b8b4eed9d23e6330eda863e43ca78bb174a3
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/69371
Reviewed-by: Boris Mittelberg <bmbm@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Diffstat (limited to 'src/ec')
-rw-r--r-- | src/ec/google/chromeec/ec.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index 01f9ff476b..906b5f8126 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -948,7 +948,7 @@ uint32_t google_chromeec_get_sku_id(void) return resp.sku_id; } -static uint16_t google_chromeec_get_uptime_info( +static bool google_chromeec_get_uptime_info( struct ec_response_uptime_info *resp) { struct chromeec_command cmd = { @@ -961,8 +961,7 @@ static uint16_t google_chromeec_get_uptime_info( .cmd_dev_index = 0, }; - google_chromeec_command(&cmd); - return cmd.cmd_code; + return google_chromeec_command(&cmd) == 0; } bool google_chromeec_get_ap_watchdog_flag(void) @@ -970,7 +969,7 @@ bool google_chromeec_get_ap_watchdog_flag(void) int i; struct ec_response_uptime_info resp; - if (google_chromeec_get_uptime_info(&resp)) + if (!google_chromeec_get_uptime_info(&resp)) return false; if (resp.ec_reset_flags & EC_RESET_FLAG_AP_WATCHDOG) @@ -1297,7 +1296,7 @@ static void google_chromeec_log_uptimeinfo(void) struct ec_response_uptime_info cmd_resp; int i, flag, flag_count; - if (google_chromeec_get_uptime_info(&cmd_resp)) { + if (!google_chromeec_get_uptime_info(&cmd_resp)) { /* * Deliberately say nothing for EC's that don't support this * command |