summaryrefslogtreecommitdiff
path: root/zephyr/emul/tcpc
diff options
context:
space:
mode:
authorTomasz Michalec <tm@semihalf.com>2022-01-05 16:53:25 +0100
committerCommit Bot <commit-bot@chromium.org>2022-01-14 23:05:41 +0000
commit73bf71c5681f27da09b99cd6327c5f1157a7031f (patch)
tree11e2a216548105e4e7b0e4ff0b076e1654e425aa /zephyr/emul/tcpc
parent2a0df5b67b5582f262f7063a352c8a29f8df638f (diff)
downloadchrome-ec-73bf71c5681f27da09b99cd6327c5f1157a7031f.tar.gz
zephyr: emul: Fix clearing message queue in TCPCI partner
SYS_SLIST_CONTAINER evaluate first argument two times, so it cannot be used with expressions that have side effects. Because of that it is replaced with CONTEINER_OF to obtain message from list node. BUG=none BRANCH=none TEST=make configure --test zephyr/test/drivers Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: Ib67b08468a9ab397a289dfdabc4a1d71f0362536 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3368263 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Tested-by: Tomasz Michalec <tmichalec@google.com> Commit-Queue: Tomasz Michalec <tmichalec@google.com>
Diffstat (limited to 'zephyr/emul/tcpc')
-rw-r--r--zephyr/emul/tcpc/emul_tcpci_partner_common.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/zephyr/emul/tcpc/emul_tcpci_partner_common.c b/zephyr/emul/tcpc/emul_tcpci_partner_common.c
index f6bff888af..e14337df5d 100644
--- a/zephyr/emul/tcpc/emul_tcpci_partner_common.c
+++ b/zephyr/emul/tcpc/emul_tcpci_partner_common.c
@@ -227,9 +227,8 @@ int tcpci_partner_clear_msg_queue(struct tcpci_partner_data *data)
}
while (!sys_slist_is_empty(&data->to_send)) {
- msg = SYS_SLIST_CONTAINER(
- sys_slist_get_not_empty(&data->to_send),
- msg, node);
+ msg = CONTAINER_OF(sys_slist_get_not_empty(&data->to_send),
+ struct tcpci_partner_msg, node);
tcpci_partner_free_msg(msg);
}