mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 16:52:14 +02:00
efi_loader: consistent error handling in efidebug.c
If a variable cannot be set, always show an information message. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
@@ -506,7 +506,7 @@ static int do_efi_boot_add(cmd_tbl_t *cmdtp, int flag,
|
|||||||
void *data = NULL;
|
void *data = NULL;
|
||||||
efi_uintn_t size;
|
efi_uintn_t size;
|
||||||
efi_status_t ret;
|
efi_status_t ret;
|
||||||
int r;
|
int r = CMD_RET_SUCCESS;
|
||||||
|
|
||||||
if (argc < 6 || argc > 7)
|
if (argc < 6 || argc > 7)
|
||||||
return CMD_RET_USAGE;
|
return CMD_RET_USAGE;
|
||||||
@@ -563,7 +563,10 @@ static int do_efi_boot_add(cmd_tbl_t *cmdtp, int flag,
|
|||||||
EFI_VARIABLE_BOOTSERVICE_ACCESS |
|
EFI_VARIABLE_BOOTSERVICE_ACCESS |
|
||||||
EFI_VARIABLE_RUNTIME_ACCESS,
|
EFI_VARIABLE_RUNTIME_ACCESS,
|
||||||
size, data));
|
size, data));
|
||||||
r = (ret == EFI_SUCCESS ? CMD_RET_SUCCESS : CMD_RET_FAILURE);
|
if (ret != EFI_SUCCESS) {
|
||||||
|
printf("Cannot set %ls\n", var_name16);
|
||||||
|
r = CMD_RET_FAILURE;
|
||||||
|
}
|
||||||
out:
|
out:
|
||||||
free(data);
|
free(data);
|
||||||
efi_free_pool(device_path);
|
efi_free_pool(device_path);
|
||||||
@@ -610,7 +613,7 @@ static int do_efi_boot_rm(cmd_tbl_t *cmdtp, int flag,
|
|||||||
|
|
||||||
ret = EFI_CALL(RT->set_variable(var_name16, &guid, 0, 0, NULL));
|
ret = EFI_CALL(RT->set_variable(var_name16, &guid, 0, 0, NULL));
|
||||||
if (ret) {
|
if (ret) {
|
||||||
printf("cannot remove Boot%04X", id);
|
printf("Cannot remove Boot%04X", id);
|
||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -897,7 +900,7 @@ static int do_efi_boot_next(cmd_tbl_t *cmdtp, int flag,
|
|||||||
char *endp;
|
char *endp;
|
||||||
efi_guid_t guid;
|
efi_guid_t guid;
|
||||||
efi_status_t ret;
|
efi_status_t ret;
|
||||||
int r;
|
int r = CMD_RET_SUCCESS;
|
||||||
|
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
return CMD_RET_USAGE;
|
return CMD_RET_USAGE;
|
||||||
@@ -916,7 +919,10 @@ static int do_efi_boot_next(cmd_tbl_t *cmdtp, int flag,
|
|||||||
EFI_VARIABLE_BOOTSERVICE_ACCESS |
|
EFI_VARIABLE_BOOTSERVICE_ACCESS |
|
||||||
EFI_VARIABLE_RUNTIME_ACCESS,
|
EFI_VARIABLE_RUNTIME_ACCESS,
|
||||||
size, &bootnext));
|
size, &bootnext));
|
||||||
r = (ret == EFI_SUCCESS ? CMD_RET_SUCCESS : CMD_RET_FAILURE);
|
if (ret != EFI_SUCCESS) {
|
||||||
|
printf("Cannot set BootNext\n");
|
||||||
|
r = CMD_RET_FAILURE;
|
||||||
|
}
|
||||||
out:
|
out:
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@@ -943,7 +949,7 @@ static int do_efi_boot_order(cmd_tbl_t *cmdtp, int flag,
|
|||||||
char *endp;
|
char *endp;
|
||||||
efi_guid_t guid;
|
efi_guid_t guid;
|
||||||
efi_status_t ret;
|
efi_status_t ret;
|
||||||
int r;
|
int r = CMD_RET_SUCCESS;
|
||||||
|
|
||||||
if (argc == 1)
|
if (argc == 1)
|
||||||
return show_efi_boot_order();
|
return show_efi_boot_order();
|
||||||
@@ -973,7 +979,10 @@ static int do_efi_boot_order(cmd_tbl_t *cmdtp, int flag,
|
|||||||
EFI_VARIABLE_BOOTSERVICE_ACCESS |
|
EFI_VARIABLE_BOOTSERVICE_ACCESS |
|
||||||
EFI_VARIABLE_RUNTIME_ACCESS,
|
EFI_VARIABLE_RUNTIME_ACCESS,
|
||||||
size, bootorder));
|
size, bootorder));
|
||||||
r = (ret == EFI_SUCCESS ? CMD_RET_SUCCESS : CMD_RET_FAILURE);
|
if (ret != EFI_SUCCESS) {
|
||||||
|
printf("Cannot set BootOrder\n");
|
||||||
|
r = CMD_RET_FAILURE;
|
||||||
|
}
|
||||||
out:
|
out:
|
||||||
free(bootorder);
|
free(bootorder);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user