summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Michalec <tm@semihalf.com>2021-11-18 17:01:15 +0100
committerCommit Bot <commit-bot@chromium.org>2021-11-18 21:02:10 +0000
commitf537dffb9bde158166fa00ce9ab8d0ce217e7ae6 (patch)
treeb5d582dcd93fe565d01fbf617cfe2b48b03e4c53
parentf91fed25a84330e829e874b3207852cf2b526725 (diff)
downloadchrome-ec-f537dffb9bde158166fa00ce9ab8d0ce217e7ae6.tar.gz
zephyr: Fix uninitialised tx_status_alert variable
In tcpci_emul_partner_msg_status() it was possible to pass wrong status argument which leads to use of uninitialised tx_status_alert variable. Now tcpci_emul_partner_msg_status() check status argument first. BUG=none BRANCH=none TEST=make configure --test zephyr/test/drivers Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: If2d67f37e856efec552517073ef4bad4384b3ab1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3290722 Tested-by: Tomasz Michalec <tmichalec@google.com> Commit-Queue: Tomasz Michalec <tmichalec@google.com> Reviewed-by: Tristan Honscheid <honscheid@google.com>
-rw-r--r--zephyr/emul/emul_tcpci.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/zephyr/emul/emul_tcpci.c b/zephyr/emul/emul_tcpci.c
index bd214a6406..b2c21c2ec4 100644
--- a/zephyr/emul/emul_tcpci.c
+++ b/zephyr/emul/emul_tcpci.c
@@ -452,6 +452,9 @@ void tcpci_emul_partner_msg_status(const struct emul *emul,
case TCPCI_EMUL_TX_FAILED:
tx_status_alert = TCPC_REG_ALERT_TX_FAILED;
break;
+ default:
+ __ASSERT(0, "Invalid partner TX status 0x%x", status);
+ return;
}
tcpci_emul_get_reg(emul, TCPC_REG_ALERT, &alert);