diff --git a/fs/fcb2/src/fcb_getprev.c b/fs/fcb2/src/fcb_getprev.c index f543b5d90f..6d41f44ba4 100644 --- a/fs/fcb2/src/fcb_getprev.c +++ b/fs/fcb2/src/fcb_getprev.c @@ -34,7 +34,7 @@ fcb2_sector_find_last(struct fcb2 *fcb, struct fcb2_entry *loc) if (rc == 0) { last_valid = loc->fe_entry_num; } - if (rc == FCB2_ERR_NOVAR) { + else if (rc == FCB2_ERR_NOVAR) { /* * Out entries in this sector */ @@ -52,7 +52,7 @@ fcb2_sector_find_last(struct fcb2 *fcb, struct fcb2_entry *loc) } } loc->fe_entry_num++; - } while (1); + } while (rc == 0); return rc; }