diff options
author | Diana Z <dzigterman@chromium.org> | 2020-07-22 10:25:37 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-07-24 02:07:29 +0000 |
commit | ef356b8e6b9fcf665e67a9599323ad0af74eea08 (patch) | |
tree | 7b11022ba2db61e8375c0c20bab7e96209b5352d | |
parent | fa2cd7a5765b067e070152adf0a9678addbfa55f (diff) | |
download | chrome-ec-ef356b8e6b9fcf665e67a9599323ad0af74eea08.tar.gz |
TCPCI: Check for failed i2c write before using alert register
If the read to the alert register fails, bail on the alert processing
since there is no valid data to work with.
BRANCH=None
BUG=b:161765813,b:160973127
TEST=on waddledoo, ensure non-error path still works
Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: I69fff30967132da29d34a41b5a9c4631afb0545d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2313421
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
-rw-r--r-- | driver/tcpm/tcpci.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c index ae03f7e097..3437037597 100644 --- a/driver/tcpm/tcpci.c +++ b/driver/tcpm/tcpci.c @@ -1087,7 +1087,10 @@ void tcpci_tcpc_alert(int port) uint32_t pd_event = 0; /* Read the Alert register from the TCPC */ - tcpm_alert_status(port, &alert); + if (tcpm_alert_status(port, &alert)) { + CPRINTS("C%d: Failed to read alert register", port); + return; + } /* Get Extended Alert register if needed */ if (alert & TCPC_REG_ALERT_ALERT_EXT) |