]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
cmd: env: print a message when setting UEFI variable failed
authorAKASHI Takahiro <takahiro.akashi@linaro.org>
Tue, 28 May 2019 00:00:35 +0000 (09:00 +0900)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Tue, 4 Jun 2019 20:09:26 +0000 (22:09 +0200)
Error message will alert a user that setting/deleting a variable failed.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
cmd/nvedit_efi.c

index 2805e8182b41fbafba75d44724b1c7b1933eb5d5..ff8eaa1aad2df4c2b23678daee3f52017e44b38d 100644 (file)
@@ -373,6 +373,8 @@ int do_env_set_efi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
                for ( ; argc > 0; argc--, argv++)
                        if (append_value(&value, &size, argv[0]) < 0) {
+                               printf("## Failed to process an argument, %s\n",
+                                      argv[0]);
                                ret = CMD_RET_FAILURE;
                                goto out;
                        }
@@ -381,6 +383,7 @@ int do_env_set_efi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        len = utf8_utf16_strnlen(var_name, strlen(var_name));
        var_name16 = malloc((len + 1) * 2);
        if (!var_name16) {
+               printf("## Out of memory\n");
                ret = CMD_RET_FAILURE;
                goto out;
        }
@@ -392,7 +395,12 @@ int do_env_set_efi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                                        EFI_VARIABLE_BOOTSERVICE_ACCESS |
                                        EFI_VARIABLE_RUNTIME_ACCESS,
                                        size, value));
-       ret = (ret == EFI_SUCCESS ? CMD_RET_SUCCESS : CMD_RET_FAILURE);
+       if (ret == EFI_SUCCESS) {
+               ret = CMD_RET_SUCCESS;
+       } else {
+               printf("## Failed to set EFI variable\n");
+               ret = CMD_RET_FAILURE;
+       }
 out:
        free(value);
        free(var_name16);