diff mbox series

[U-Boot,v3] cmd: env: print a message when setting UEFI variable failed

Message ID 20190528000035.20425-1-takahiro.akashi@linaro.org
State Accepted
Commit 8190b4a3e01c80fed782e206e49696d64fedd8a6
Delegated to: Heinrich Schuchardt
Headers show
Series [U-Boot,v3] cmd: env: print a message when setting UEFI variable failed | expand

Commit Message

AKASHI Takahiro May 28, 2019, midnight UTC
Error message will alert a user that setting/deleting a variable failed.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
Changes in v3 (May 28, 2019)
* change messages as Heinrich suggested

Changes in v2 (May 24, 2019)
* change a message to "Out of memory"
* add more error messages
---
 cmd/nvedit_efi.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Heinrich Schuchardt May 28, 2019, 5:58 a.m. UTC | #1
On 5/28/19 2:00 AM, AKASHI Takahiro wrote:
> 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>
> ---
> Changes in v3 (May 28, 2019)
> * change messages as Heinrich suggested
>
> Changes in v2 (May 24, 2019)
> * change a message to "Out of memory"
> * add more error messages
> ---
diff mbox series

Patch

diff --git a/cmd/nvedit_efi.c b/cmd/nvedit_efi.c
index 2805e8182b41..ff8eaa1aad2d 100644
--- a/cmd/nvedit_efi.c
+++ b/cmd/nvedit_efi.c
@@ -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);