Commit 2766c788 authored by Andrej Butok's avatar Andrej Butok Committed by Fabio Baltieri
Browse files

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: default avatarAndrej Butok <andrey.butok@nxp.com>
parent 4ca811b4
Loading
Loading
Loading
Loading
+2 −1
Changes for samples/subsys/fs/zms/src/main.c: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -161,7 +161,8 @@ int main(void)
		rc = zms_read(&fs, CNT_ID, &i_cnt, sizeof(i_cnt));
		if (rc > 0) { /* item was found, show it */
			printk("Id: %d, loop_cnt: %u\n", CNT_ID, i_cnt);
			if (i_cnt != (i - 1)) {
			if ((i > 0) && (i_cnt != (i - 1))) {
				printk("Error loop_cnt %u must be %d\n", i_cnt, i - 1);
				break;
			}
		}