diff options
author | Nicolas Boichat <drinkcat@google.com> | 2016-10-20 10:23:54 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-10-20 04:42:37 -0700 |
commit | 588a45687d3bbe2b184ca4f85e61b69677ef680e (patch) | |
tree | de64b2c5e5a8b841c06477653831933c2bc6ebe6 /common/host_command_pd.c | |
parent | fb0d464fbd8849fd2206f927aca21e3fe2c85f5d (diff) | |
download | chrome-ec-588a45687d3bbe2b184ca4f85e61b69677ef680e.tar.gz |
host_command_pd: pd_exchange_status: Fix first_exchange logic
The code clearly indends to sleep on the second time the loop
is taken, but the variable first_exchange is reset to 1 inside
the loop. If, for whatever reason, PD alert status cannot be
cleared, the code will then loop forever, and lead to a watchdog
reset.
BRANCH=none
BUG=chrome-os-partner:58750
TEST=Flash EC RO using ec_util
Run fwupdatetest with charger unplugged for 10 iterations.
Change-Id: I9e13f2523111853fdc5c45e75886c11f1c8006eb
Reviewed-on: https://chromium-review.googlesource.com/401238
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'common/host_command_pd.c')
-rw-r--r-- | common/host_command_pd.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/common/host_command_pd.c b/common/host_command_pd.c index 1042b2f232..fbfad43918 100644 --- a/common/host_command_pd.c +++ b/common/host_command_pd.c @@ -157,6 +157,10 @@ static int pd_get_alert(void) static void pd_exchange_status(uint32_t ec_state) { +#ifdef USB_TCPM_WITH_OFF_CHIP_TCPC + int first_exchange = 1; +#endif + #ifdef CONFIG_HOSTCMD_PD struct ec_params_pd_status ec_status; struct ec_response_pd_status pd_status; @@ -168,7 +172,6 @@ static void pd_exchange_status(uint32_t ec_state) #ifdef USB_TCPM_WITH_OFF_CHIP_TCPC /* Loop until the alert gpio is not active */ do { - int first_exchange = 1; #endif #ifdef CONFIG_HOSTCMD_PD |