Skip to content

Commit

Permalink
Drop ignored return code from save_current_config
Browse files Browse the repository at this point in the history
The caller ignores it, and we can simplify the code when only printing
but not returning an error.

Signed-off-by: Jan Kiszka <[email protected]>
  • Loading branch information
jan-kiszka committed Dec 9, 2024
1 parent 4a3e07c commit 9eb8097
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions env/fatvars.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@
static int current_partition = 0;
static BG_ENVDATA *env;

static BG_STATUS save_current_config(const UINTN *config_volumes, UINTN numHandles)
static VOID save_current_config(const UINTN *config_volumes, UINTN numHandles)
{
EFI_STATUS efistatus;

if (numHandles != ENV_NUM_CONFIG_PARTS) {
ERROR(L"Unexpected number of config partitions: found %d, but expected %d.\n",
numHandles, ENV_NUM_CONFIG_PARTS);
/* In case of saving, this must be treated as error, to not
* overwrite another partition's config file. */
return BG_CONFIG_ERROR;
ERROR(L"Unexpected number of config partitions: found %d, but expected %d.\n",
numHandles, ENV_NUM_CONFIG_PARTS);
return;
}

VOLUME_DESC *v = &volumes[config_volumes[current_partition]];
Expand All @@ -42,7 +42,7 @@ static BG_STATUS save_current_config(const UINTN *config_volumes, UINTN numHandl
if (EFI_ERROR(efistatus)) {
ERROR(L"Could not open environment file on system partition %d: %r\n",
current_partition, efistatus);
return BG_CONFIG_ERROR;
return;
}

UINTN writelen = sizeof(BG_ENVDATA);
Expand All @@ -55,16 +55,11 @@ static BG_STATUS save_current_config(const UINTN *config_volumes, UINTN numHandl
efistatus = fh->Write(fh, &writelen, (VOID *)&env[current_partition]);
if (EFI_ERROR(efistatus)) {
ERROR(L"Cannot write environment to file: %r\n", efistatus);
(VOID) close_cfg_file(v->root, fh);
return BG_CONFIG_ERROR;
}

if (EFI_ERROR(close_cfg_file(v->root, fh))) {
ERROR(L"Could not close environment config file.\n");
return BG_CONFIG_ERROR;
}

return BG_SUCCESS;
}

BG_STATUS load_config(BG_LOADER_PARAMS *bglp)
Expand Down

0 comments on commit 9eb8097

Please sign in to comment.