nvs: fix return with held lock

An internal early return left a mutex locked.

See https://habr.com/en/company/pvs-studio/blog/495284/ fragments 13
and 14.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
Peter Bigot 2020-04-05 11:35:20 -05:00 committed by Anas Nashif
commit 7bdc235775

View file

@ -571,7 +571,8 @@ static int nvs_startup(struct nvs_fs *fs)
}
/* all sectors are closed, this is not a nvs fs */
if (closed_sectors == fs->sector_count) {
return -EDEADLK;
rc = -EDEADLK;
goto end;
}
if (i == fs->sector_count) {
@ -617,7 +618,8 @@ static int nvs_startup(struct nvs_fs *fs)
*/
if (fs->ate_wra == fs->data_wra && last_ate.len) {
/* not a delete ate */
return -ESPIPE;
rc = -ESPIPE;
goto end;
}
}