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:
parent
abbd53ce1f
commit
7bdc235775
1 changed files with 4 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue