summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Michalec <tm@semihalf.com>2022-02-03 16:47:33 +0100
committerCommit Bot <commit-bot@chromium.org>2022-02-21 17:39:51 +0000
commit8c6c6c79784b4547bab7c403957d226035c52e23 (patch)
tree4807614be3b222959908ea6a29584a34dbb71b47
parentc72cc8c8294bcbbcdf95a995ca21b53744bd778f (diff)
downloadchrome-ec-8c6c6c79784b4547bab7c403957d226035c52e23.tar.gz
tests: TCPMv2: reset tc structure only for one port
In tc_state_init() reset tc structure only for port which is argument of tc_state_init() call. Resetting structure for different PD task may cause misbehaviour of other port. This reset is only required for test builds. BUG=none BRANCH=none TEST=zmake configure --test test-drivers TEST=make runhosttests Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I777007064760d8288cad4d8ab8d790fed0e496ca Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3437446 Tested-by: Tomasz Michalec <tmichalec@google.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Tomasz Michalec <tmichalec@google.com>
-rw-r--r--common/usbc/usb_tc_drp_acc_trysrc_sm.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
index 83e915d3b2..e40efb380c 100644
--- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c
+++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
@@ -1549,12 +1549,8 @@ void tc_state_init(int port)
/* For test builds, replicate static initialization */
if (IS_ENABLED(TEST_BUILD)) {
- int i;
-
- for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; ++i) {
- memset(&tc[i], 0, sizeof(tc[i]));
- drp_state[i] = CONFIG_USB_PD_INITIAL_DRP_STATE;
- }
+ memset(&tc[port], 0, sizeof(tc[port]));
+ drp_state[port] = CONFIG_USB_PD_INITIAL_DRP_STATE;
}
/* If port is not available, there is nothing to initialize */