Martin L Roth has submitted this change. ( https://review.coreboot.org/c/coreboot/+/69371 )
Change subject: ec/google/chromeec: Simplify get_uptime_info error handling ......................................................................
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 --- M src/ec/google/chromeec/ec.c 1 file changed, 26 insertions(+), 5 deletions(-)
Approvals: build bot (Jenkins): Verified Boris Mittelberg: Looks good to me, but someone else must approve Eric Lai: Looks good to me, approved
diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index 01f9ff4..906b5f8 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -948,7 +948,7 @@ 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 @@ .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 @@ 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 @@ 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