diff options
author | Patryk Duda <pdk@semihalf.com> | 2020-06-18 09:38:20 +0200 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-23 01:02:52 +0000 |
commit | d6ef825953626dbbf9fbf50d43ff165429889dd5 (patch) | |
tree | f8e64de2b9c27da586f624d9e47ff9a6f54482c2 | |
parent | 2811551d43dd51c574c0fb98d70df7e82d8cc922 (diff) | |
download | chrome-ec-d6ef825953626dbbf9fbf50d43ff165429889dd5.tar.gz |
usb_pd_tcpc: Don't process tcpc_run() when port is not available
Function tcpc_run() is responsible for receiving, transmitting
messages but also for sampling CC lines. Running this for inexistent
ports doesn't make any sense.
BUG=b:154602760
BRANCH=none
TEST=make buildall -j
Signed-off-by: Patryk Duda <pdk@semihalf.com>
Change-Id: I8fe11719e35a1c99f307ebb9d581c3531d79177a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2250683
Commit-Queue: Jett Rink <jettrink@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
-rw-r--r-- | common/usb_pd_tcpc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/common/usb_pd_tcpc.c b/common/usb_pd_tcpc.c index d8290c49bb..5100319115 100644 --- a/common/usb_pd_tcpc.c +++ b/common/usb_pd_tcpc.c @@ -835,6 +835,10 @@ int tcpc_run(int port, int evt) { int cc, i, res; + /* Don't do anything when port is not available */ + if (port >= board_get_usb_pd_port_count()) + return -1; + /* incoming packet ? */ if (pd_rx_started(port) && pd[port].rx_enabled) { /* Get message and place at RX buffer head */ |