summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2020-07-22 10:25:37 -0600
committerCommit Bot <commit-bot@chromium.org>2020-07-24 02:07:29 +0000
commitef356b8e6b9fcf665e67a9599323ad0af74eea08 (patch)
tree7b11022ba2db61e8375c0c20bab7e96209b5352d /driver
parentfa2cd7a5765b067e070152adf0a9678addbfa55f (diff)
downloadchrome-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>
Diffstat (limited to 'driver')
-rw-r--r--driver/tcpm/tcpci.c5
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)