Skip to content

Commit 9fdf06e

Browse files
de-nordicnashif
authored andcommitted
settings: Add fs_file_t type variable initializations
The commit adds initializations of fs_file_t variables in preparation for fs_open function change that will require fs_file_t object, passed to the function, to be initialized before first usage. Signed-off-by: Dominik Ermel <[email protected]>
1 parent 40572fd commit 9fdf06e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

subsys/settings/src/settings_file.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ static int settings_file_load_priv(struct settings_store *cs, line_load_cb cb,
123123

124124
lines = 0;
125125

126+
fs_file_t_init(&file);
127+
126128
rc = fs_open(&file, cf->cf_name, FS_O_CREATE | FS_O_RDWR);
127129
if (rc != 0) {
128130
return -EINVAL;
@@ -240,6 +242,9 @@ static int settings_file_save_and_compress(struct settings_file *cf,
240242
size_t new_name_len;
241243
size_t val1_off;
242244

245+
fs_file_t_init(&rf);
246+
fs_file_t_init(&wf);
247+
243248
if (fs_open(&rf, cf->cf_name, FS_O_CREATE | FS_O_RDWR) != 0) {
244249
return -ENOEXEC;
245250
}
@@ -360,14 +365,16 @@ static int settings_file_save_priv(struct settings_store *cs, const char *name,
360365
{
361366
struct settings_file *cf = (struct settings_file *)cs;
362367
struct line_entry_ctx entry_ctx;
363-
struct fs_file_t file;
368+
struct fs_file_t file;
364369
int rc2;
365370
int rc;
366371

367372
if (!name) {
368373
return -EINVAL;
369374
}
370375

376+
fs_file_t_init(&file);
377+
371378
if (cf->cf_maxlines && (cf->cf_lines + 1 >= cf->cf_maxlines)) {
372379
/*
373380
* Compress before config file size exceeds

0 commit comments

Comments
 (0)