mkiiskila closed pull request #1083:  fcb; was not dealing with flash read 
failure from the middle of sector
URL: https://github.com/apache/mynewt-core/pull/1083
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/fs/fcb/include/fcb/fcb.h b/fs/fcb/include/fcb/fcb.h
index 08915394ab..fa6bc16b06 100644
--- a/fs/fcb/include/fcb/fcb.h
+++ b/fs/fcb/include/fcb/fcb.h
@@ -84,8 +84,6 @@ struct fcb_log {
     uint8_t fl_entries;
 };
 
-int log_fcb_init(struct fcb_log *fcblog, struct fcb *fcb, uint16_t entries);
-
 /*
  * fcb_append() appends an entry to circular buffer. When writing the
  * contents for the entry, use loc->fl_area and loc->fl_data_off with
diff --git a/fs/fcb/src/fcb.c b/fs/fcb/src/fcb.c
index c4dbeb2901..a48f86a095 100644
--- a/fs/fcb/src/fcb.c
+++ b/fs/fcb/src/fcb.c
@@ -235,9 +235,8 @@ fcb_offset_last_n(struct fcb *fcb, uint8_t entries,
         if (i == 0) {
             /* Start from the beginning of fcb entries */
             *last_n_entry = loc;
-        }
-        /* Update last_n_entry after n entries and keep updating */
-        else if (i > (entries - 1)) {
+        } else if (i > (entries - 1)) {
+            /* Update last_n_entry after n entries and keep updating */
             fcb_getnext(fcb, last_n_entry);
         }
         i++;
diff --git a/fs/fcb/src/fcb_getnext.c b/fs/fcb/src/fcb_getnext.c
index 07d4faea82..6ca08ce85c 100644
--- a/fs/fcb/src/fcb_getnext.c
+++ b/fs/fcb/src/fcb_getnext.c
@@ -68,22 +68,16 @@ fcb_getnext_nolock(struct fcb *fcb, struct fcb_entry *loc)
          */
         loc->fe_elem_off = sizeof(struct fcb_disk_area);
         rc = fcb_elem_info(fcb, loc);
-        switch (rc) {
-        case 0:
-            return 0;
-        case FCB_ERR_CRC:
-            break;
-        default:
-            goto next_sector;
-        }
     } else {
         rc = fcb_getnext_in_area(fcb, loc);
-        if (rc == 0) {
-            return 0;
-        }
-        if (rc == FCB_ERR_NOVAR) {
-            goto next_sector;
-        }
+    }
+    switch (rc) {
+    case 0:
+        return 0;
+    case FCB_ERR_CRC:
+        break;
+    default:
+        goto next_sector;
     }
     while (rc == FCB_ERR_CRC) {
         rc = fcb_getnext_in_area(fcb, loc);


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to