You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2016/07/27 20:17:32 UTC

[2/2] incubator-mynewt-core git commit: log; fix the use of image scratch when rotating logs. Need to erase the area before trying to use it.

log; fix the use of image scratch when rotating logs. Need to erase
the area before trying to use it.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/a0810f7e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/a0810f7e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/a0810f7e

Branch: refs/heads/develop
Commit: a0810f7ebca6d3d02296dff9a9557d85d2f8d3fa
Parents: 4240de7
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Wed Jul 27 13:16:15 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Wed Jul 27 13:16:15 2016 -0700

----------------------------------------------------------------------
 sys/log/src/log_fcb.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a0810f7e/sys/log/src/log_fcb.c
----------------------------------------------------------------------
diff --git a/sys/log/src/log_fcb.c b/sys/log/src/log_fcb.c
index 2384c83..3bfde04 100644
--- a/sys/log/src/log_fcb.c
+++ b/sys/log/src/log_fcb.c
@@ -245,16 +245,12 @@ log_fcb_rtr_erase(struct log *log, void *arg)
     fcb_scratch.f_magic = 0x7EADBADF;
     fcb_scratch.f_version = 0;
 
+    flash_area_erase(&sector, 0, sector.fa_size);
     rc = fcb_init(&fcb_scratch);
     if (rc) {
         goto err;
     }
 
-    rc = fcb_clear(&fcb_scratch);
-    if (rc) {
-        goto err;
-    }
-
     /* Calculate offset of n-th last entry */
     rc = fcb_offset_last_n(fcb, fcb_log->fl_entries, &offset);
     if (rc) {