summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/Kconfig3
-rw-r--r--cmd/efidebug.c36
-rw-r--r--cmd/fs.c5
-rw-r--r--cmd/led.c2
-rw-r--r--cmd/usb_gadget_sdp.c11
5 files changed, 36 insertions, 21 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 0badcb3fe0..cda7931fe3 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1035,11 +1035,13 @@ config CMD_SDRAM
config CMD_SF
bool "sf"
+ depends on DM_SPI_FLASH || SPI_FLASH
help
SPI Flash support
config CMD_SF_TEST
bool "sf test - Allow testing of SPI flash"
+ depends on CMD_SF
help
Provides a way to test that SPI flash is working correctly. The
test is destructive, in that an area of SPI flash must be provided
@@ -1051,6 +1053,7 @@ config CMD_SF_TEST
config CMD_SPI
bool "sspi - Command to access spi device"
+ depends on SPI
help
SPI utility command.
diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index e657226254..cb152b3339 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -505,7 +505,8 @@ static int do_efi_boot_add(cmd_tbl_t *cmdtp, int flag,
struct efi_load_option lo;
void *data = NULL;
efi_uintn_t size;
- int ret;
+ efi_status_t ret;
+ int r = CMD_RET_SUCCESS;
if (argc < 6 || argc > 7)
return CMD_RET_USAGE;
@@ -538,7 +539,7 @@ static int do_efi_boot_add(cmd_tbl_t *cmdtp, int flag,
if (ret != EFI_SUCCESS) {
printf("Cannot create device path for \"%s %s\"\n",
argv[3], argv[4]);
- ret = CMD_RET_FAILURE;
+ r = CMD_RET_FAILURE;
goto out;
}
lo.file_path = file_path;
@@ -553,7 +554,7 @@ static int do_efi_boot_add(cmd_tbl_t *cmdtp, int flag,
size = efi_serialize_load_option(&lo, (u8 **)&data);
if (!size) {
- ret = CMD_RET_FAILURE;
+ r = CMD_RET_FAILURE;
goto out;
}
@@ -562,14 +563,17 @@ static int do_efi_boot_add(cmd_tbl_t *cmdtp, int flag,
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
size, data));
- ret = (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:
free(data);
efi_free_pool(device_path);
efi_free_pool(file_path);
free(lo.label);
- return ret;
+ return r;
}
/**
@@ -609,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));
if (ret) {
- printf("cannot remove Boot%04X", id);
+ printf("Cannot remove Boot%04X", id);
return CMD_RET_FAILURE;
}
}
@@ -896,6 +900,7 @@ static int do_efi_boot_next(cmd_tbl_t *cmdtp, int flag,
char *endp;
efi_guid_t guid;
efi_status_t ret;
+ int r = CMD_RET_SUCCESS;
if (argc != 2)
return CMD_RET_USAGE;
@@ -903,7 +908,7 @@ static int do_efi_boot_next(cmd_tbl_t *cmdtp, int flag,
bootnext = (u16)simple_strtoul(argv[1], &endp, 16);
if (*endp != '\0' || bootnext > 0xffff) {
printf("invalid value: %s\n", argv[1]);
- ret = CMD_RET_FAILURE;
+ r = CMD_RET_FAILURE;
goto out;
}
@@ -914,9 +919,12 @@ static int do_efi_boot_next(cmd_tbl_t *cmdtp, int flag,
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
size, &bootnext));
- ret = (ret == EFI_SUCCESS ? CMD_RET_SUCCESS : CMD_RET_FAILURE);
+ if (ret != EFI_SUCCESS) {
+ printf("Cannot set BootNext\n");
+ r = CMD_RET_FAILURE;
+ }
out:
- return ret;
+ return r;
}
/**
@@ -941,6 +949,7 @@ static int do_efi_boot_order(cmd_tbl_t *cmdtp, int flag,
char *endp;
efi_guid_t guid;
efi_status_t ret;
+ int r = CMD_RET_SUCCESS;
if (argc == 1)
return show_efi_boot_order();
@@ -957,7 +966,7 @@ static int do_efi_boot_order(cmd_tbl_t *cmdtp, int flag,
id = (int)simple_strtoul(argv[i], &endp, 16);
if (*endp != '\0' || id > 0xffff) {
printf("invalid value: %s\n", argv[i]);
- ret = CMD_RET_FAILURE;
+ r = CMD_RET_FAILURE;
goto out;
}
@@ -970,11 +979,14 @@ static int do_efi_boot_order(cmd_tbl_t *cmdtp, int flag,
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
size, bootorder));
- ret = (ret == EFI_SUCCESS ? CMD_RET_SUCCESS : CMD_RET_FAILURE);
+ if (ret != EFI_SUCCESS) {
+ printf("Cannot set BootOrder\n");
+ r = CMD_RET_FAILURE;
+ }
out:
free(bootorder);
- return ret;
+ return r;
}
static cmd_tbl_t cmd_efidebug_boot_sub[] = {
diff --git a/cmd/fs.c b/cmd/fs.c
index aaafbf9b52..db74767b7b 100644
--- a/cmd/fs.c
+++ b/cmd/fs.c
@@ -8,7 +8,6 @@
#include <common.h>
#include <command.h>
#include <fs.h>
-#include <efi_loader.h>
static int do_size_wrapper(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
@@ -26,10 +25,6 @@ U_BOOT_CMD(
static int do_load_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
{
-#ifdef CONFIG_CMD_BOOTEFI
- efi_set_bootdev(argv[1], (argc > 2) ? argv[2] : "",
- (argc > 4) ? argv[4] : "");
-#endif
return do_load(cmdtp, flag, argc, argv, FS_TYPE_ANY);
}
diff --git a/cmd/led.c b/cmd/led.c
index 403abbc6bc..50ffa509ab 100644
--- a/cmd/led.c
+++ b/cmd/led.c
@@ -137,6 +137,6 @@ U_BOOT_CMD(
led, 4, 1, do_led,
"manage LEDs",
"<led_label> on|off|toggle" BLINK "\tChange LED state\n"
- "led [<led_label>]\tGet LED state\n"
+ "led <led_label>\tGet LED state\n"
"led list\t\tshow a list of LEDs"
);
diff --git a/cmd/usb_gadget_sdp.c b/cmd/usb_gadget_sdp.c
index 808ed974fa..2ead06be9f 100644
--- a/cmd/usb_gadget_sdp.c
+++ b/cmd/usb_gadget_sdp.c
@@ -13,7 +13,7 @@
static int do_sdp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
- int ret = CMD_RET_FAILURE;
+ int ret;
if (argc < 2)
return CMD_RET_USAGE;
@@ -23,7 +23,11 @@ static int do_sdp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
usb_gadget_initialize(controller_index);
g_dnl_clear_detach();
- g_dnl_register("usb_dnl_sdp");
+ ret = g_dnl_register("usb_dnl_sdp");
+ if (ret) {
+ pr_err("SDP dnl register failed: %d\n", ret);
+ goto exit_register;
+ }
ret = sdp_init(controller_index);
if (ret) {
@@ -37,9 +41,10 @@ static int do_sdp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
exit:
g_dnl_unregister();
+exit_register:
usb_gadget_release(controller_index);
- return ret;
+ return CMD_RET_FAILURE;
}
U_BOOT_CMD(sdp, 2, 1, do_sdp,