Skip to content

Commit 1827d43

Browse files
MirkoCovizzilemrey
authored andcommitted
samples: peripherals: bm_zms: LOG_INF to LOG_ERR
Changes `LOG_INF` to `LOG_ERR` where errors are reported. Signed-off-by: Mirko Covizzi <[email protected]>
1 parent efe892d commit 1827d43

File tree

1 file changed

+21
-20
lines changed
  • samples/peripherals/bm_zms/src

1 file changed

+21
-20
lines changed

samples/peripherals/bm_zms/src/main.c

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ static int delete_and_verify_items(struct bm_zms_fs *fs, uint32_t id)
7272

7373
return 0;
7474
error1:
75-
LOG_INF("Error while deleting item rc=%d", rc);
75+
LOG_ERR("Error while deleting item rc=%d", rc);
7676
return rc;
7777
error2:
78-
LOG_INF("Error, Delete failed item should not be present");
78+
LOG_ERR("Error, Delete failed item should not be present");
7979
return -1;
8080
}
8181

@@ -85,25 +85,25 @@ static int delete_basic_items(struct bm_zms_fs *fs)
8585

8686
rc = delete_and_verify_items(fs, IP_ADDRESS_ID);
8787
if (rc) {
88-
LOG_INF("Error while deleting item %x rc=%d", IP_ADDRESS_ID, rc);
88+
LOG_ERR("Error while deleting item %x rc=%d", IP_ADDRESS_ID, rc);
8989
return rc;
9090
}
9191
wait_for_ongoing_writes();
9292
rc = delete_and_verify_items(fs, KEY_VALUE_ID);
9393
if (rc) {
94-
LOG_INF("Error while deleting item %x rc=%d", KEY_VALUE_ID, rc);
94+
LOG_ERR("Error while deleting item %x rc=%d", KEY_VALUE_ID, rc);
9595
return rc;
9696
}
9797
wait_for_ongoing_writes();
9898
rc = delete_and_verify_items(fs, CNT_ID);
9999
if (rc) {
100-
LOG_INF("Error while deleting item %x rc=%d", CNT_ID, rc);
100+
LOG_ERR("Error while deleting item %x rc=%d", CNT_ID, rc);
101101
return rc;
102102
}
103103
wait_for_ongoing_writes();
104104
rc = delete_and_verify_items(fs, LONG_DATA_ID);
105105
if (rc) {
106-
LOG_INF("Error while deleting item %x rc=%d", LONG_DATA_ID, rc);
106+
LOG_ERR("Error while deleting item %x rc=%d", LONG_DATA_ID, rc);
107107
}
108108
wait_for_ongoing_writes();
109109

@@ -125,7 +125,7 @@ void bm_zms_sample_handler(bm_zms_evt_t const *p_evt)
125125
nvm_is_full = true;
126126
return;
127127
}
128-
LOG_INF("BM_ZMS Error received %d", p_evt->result);
128+
LOG_ERR("BM_ZMS Error received %d", p_evt->result);
129129
} else {
130130
LOG_WRN("Unhandled BM_ZMS event ID %u", p_evt->id);
131131
}
@@ -167,7 +167,7 @@ int main(void)
167167
for (i = 0; i < CONFIG_BM_ZMS_ITERATIONS_MAX; i++) {
168168
rc = bm_zms_mount(&fs);
169169
if (rc) {
170-
LOG_INF("Storage Init failed, rc=%d", rc);
170+
LOG_ERR("Storage Init failed, rc=%d", rc);
171171
goto idle;
172172
}
173173
wait_for_init();
@@ -188,7 +188,7 @@ int main(void)
188188
LOG_INF("Adding IP_ADDRESS %s at id %u", buf, IP_ADDRESS_ID);
189189
rc = bm_zms_write(&fs, IP_ADDRESS_ID, &buf, strlen(buf));
190190
if (rc < 0) {
191-
LOG_INF("Error while writing Entry rc=%d", rc);
191+
LOG_ERR("Error while writing Entry rc=%d", rc);
192192
goto idle;
193193
}
194194
wait_for_ongoing_writes();
@@ -205,7 +205,7 @@ int main(void)
205205
LOG_INF("Adding key/value at id %x", KEY_VALUE_ID);
206206
rc = bm_zms_write(&fs, KEY_VALUE_ID, &key, sizeof(key));
207207
if (rc < 0) {
208-
LOG_INF("Error while writing Entry rc=%d", rc);
208+
LOG_ERR("Error while writing Entry rc=%d", rc);
209209
goto idle;
210210
}
211211
wait_for_ongoing_writes();
@@ -217,14 +217,14 @@ int main(void)
217217
if (rc > 0) { /* item was found, show it */
218218
LOG_INF("Id: %d, loop_cnt: %u", CNT_ID, i_cnt);
219219
if ((i > 0) && (i_cnt != (i - 1))) {
220-
LOG_INF("Error loop_cnt %u must be %d", i_cnt, i - 1);
220+
LOG_ERR("Error loop_cnt %u must be %d", i_cnt, i - 1);
221221
goto idle;
222222
}
223223
}
224224
LOG_INF("Adding counter at id %u", CNT_ID);
225225
rc = bm_zms_write(&fs, CNT_ID, &i, sizeof(i));
226226
if (rc < 0) {
227-
LOG_INF("Error while writing Entry rc=%d", rc);
227+
LOG_ERR("Error while writing Entry rc=%d", rc);
228228
goto idle;
229229
}
230230
wait_for_ongoing_writes();
@@ -243,7 +243,7 @@ int main(void)
243243
LOG_INF("Adding Longarray at id %d", LONG_DATA_ID);
244244
rc = bm_zms_write(&fs, LONG_DATA_ID, &longarray, sizeof(longarray));
245245
if (rc < 0) {
246-
LOG_INF("Error while writing Entry rc=%d", rc);
246+
LOG_ERR("Error while writing Entry rc=%d", rc);
247247
goto idle;
248248
}
249249
wait_for_ongoing_writes();
@@ -258,7 +258,7 @@ int main(void)
258258
}
259259

260260
if (i != CONFIG_BM_ZMS_ITERATIONS_MAX) {
261-
LOG_INF("Error: Something went wrong at iteration %u rc=%d", i, rc);
261+
LOG_ERR("Error: Something went wrong at iteration %u rc=%d", i, rc);
262262
goto idle;
263263
}
264264

@@ -275,25 +275,25 @@ int main(void)
275275
/* Calculate free space and verify that it is 0 */
276276
free_space = bm_zms_calc_free_space(&fs);
277277
if (free_space < 0) {
278-
LOG_INF("Error while computing free space, rc=%d", free_space);
278+
LOG_ERR("Error while computing free space, rc=%d", free_space);
279279
goto idle;
280280
}
281281
if (free_space > 0) {
282-
LOG_INF("Error: free_space should be 0, computed %u", free_space);
282+
LOG_ERR("Error: free_space should be 0, computed %u", free_space);
283283
goto idle;
284284
}
285285
LOG_INF("Memory is full let's delete all items");
286286
/* Now delete all previously written items */
287287
for (uint32_t n = 0; n < id; n++) {
288288
rc = delete_and_verify_items(&fs, n);
289289
if (rc) {
290-
LOG_INF("Error deleting at id %u", n);
290+
LOG_ERR("Error deleting at id %u", n);
291291
goto idle;
292292
}
293293
}
294294
rc = delete_basic_items(&fs);
295295
if (rc) {
296-
LOG_INF("Error deleting basic items");
296+
LOG_ERR("Error deleting basic items");
297297
goto idle;
298298
}
299299

@@ -302,15 +302,16 @@ int main(void)
302302
*/
303303
free_space = bm_zms_calc_free_space(&fs);
304304
if (free_space < 0) {
305-
LOG_INF("Error while computing free space, rc=%d", free_space);
305+
LOG_ERR("Error while computing free space, rc=%d", free_space);
306306
goto idle;
307307
}
308308
LOG_INF("Free space in storage is %u bytes", free_space);
309309

310310
/* Let's clean the storage now */
311311
rc = bm_zms_clear(&fs);
312312
if (rc < 0) {
313-
LOG_INF("Error while cleaning the storage, rc=%d", rc);
313+
LOG_ERR("Error while cleaning the storage, rc=%d", rc);
314+
goto idle;
314315
}
315316

316317
LOG_INF("BM_ZMS sample finished Successfully");

0 commit comments

Comments
 (0)