Skip to content

Commit 2766c78

Browse files
butokfabiobaltieri
authored andcommitted
samples: zms: fix the loop_cnt iteration 0 check
- fix unwanted "Error: Something went wrong at iteration 0". - the loop_cnt check has no sense for iteration 0, comparing with wrong -1. Signed-off-by: Andrej Butok <[email protected]>
1 parent 4ca811b commit 2766c78

File tree

1 file changed

+2
-1
lines changed
  • samples/subsys/fs/zms/src

1 file changed

+2
-1
lines changed

samples/subsys/fs/zms/src/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ int main(void)
161161
rc = zms_read(&fs, CNT_ID, &i_cnt, sizeof(i_cnt));
162162
if (rc > 0) { /* item was found, show it */
163163
printk("Id: %d, loop_cnt: %u\n", CNT_ID, i_cnt);
164-
if (i_cnt != (i - 1)) {
164+
if ((i > 0) && (i_cnt != (i - 1))) {
165+
printk("Error loop_cnt %u must be %d\n", i_cnt, i - 1);
165166
break;
166167
}
167168
}

0 commit comments

Comments
 (0)