From 8cdbd1cd0b42acf8bd8de4a598373e311ba29b6f Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Wed, 21 Aug 2019 16:36:34 -0700 Subject: [PATCH] tests/kernel/common: Fix dead code in sflist test An inverted comparison typo led to the final loop in the sflist being skipped. Fix so that it actually runs. (Odd that it took a static analysis tool to detect this, the loop expressions are all constants, I'm surprised gcc didn't see it while doing unrolling analysis). Fixes #18437 Signed-off-by: Andy Ross --- tests/kernel/common/src/sflist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/kernel/common/src/sflist.c b/tests/kernel/common/src/sflist.c index e887f14540d..245704f2a47 100644 --- a/tests/kernel/common/src/sflist.c +++ b/tests/kernel/common/src/sflist.c @@ -404,7 +404,7 @@ void test_sflist(void) sys_sfnode_flags_set(node, 3 - ii); sys_sflist_append(&test_list, node); } - for (ii = 3; ii <= 0; ii--) { + for (ii = 3; ii >= 0; ii--) { node = sys_sflist_get(&test_list); zassert_equal(sys_sfnode_flags_get(node), ii, "wrong flags value");