mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-30 19:11:37 +00:00
mmc: don't allow extra cmdline arguments
The "mmc rescan" command takes no arguments. However, executing "mmc rescan 1" succeeds, leading the user to believe that MMC device 1 has been rescanned. In fact, the "current" MMC device has been rescanned, and the current device may well not be 1. Add error-checking to the "mmc" command to explicitly reject any extra command-line arguments so that it's more obvious when U-Boot isn't doing what the user thought they asked it to. Signed-off-by: Stephen Warren <swarren@nvidia.com>
This commit is contained in:
parent
5993053fa4
commit
9fd383724c
1 changed files with 12 additions and 2 deletions
|
@ -164,8 +164,12 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(argv[1], "rescan") == 0) {
|
if (strcmp(argv[1], "rescan") == 0) {
|
||||||
struct mmc *mmc = find_mmc_device(curr_device);
|
struct mmc *mmc;
|
||||||
|
|
||||||
|
if (argc != 2)
|
||||||
|
return CMD_RET_USAGE;
|
||||||
|
|
||||||
|
mmc = find_mmc_device(curr_device);
|
||||||
if (!mmc) {
|
if (!mmc) {
|
||||||
printf("no mmc device at slot %x\n", curr_device);
|
printf("no mmc device at slot %x\n", curr_device);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -179,8 +183,12 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||||
return 0;
|
return 0;
|
||||||
} else if (strncmp(argv[1], "part", 4) == 0) {
|
} else if (strncmp(argv[1], "part", 4) == 0) {
|
||||||
block_dev_desc_t *mmc_dev;
|
block_dev_desc_t *mmc_dev;
|
||||||
struct mmc *mmc = find_mmc_device(curr_device);
|
struct mmc *mmc;
|
||||||
|
|
||||||
|
if (argc != 2)
|
||||||
|
return CMD_RET_USAGE;
|
||||||
|
|
||||||
|
mmc = find_mmc_device(curr_device);
|
||||||
if (!mmc) {
|
if (!mmc) {
|
||||||
printf("no mmc device at slot %x\n", curr_device);
|
printf("no mmc device at slot %x\n", curr_device);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -196,6 +204,8 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||||
puts("get mmc type error!\n");
|
puts("get mmc type error!\n");
|
||||||
return 1;
|
return 1;
|
||||||
} else if (strcmp(argv[1], "list") == 0) {
|
} else if (strcmp(argv[1], "list") == 0) {
|
||||||
|
if (argc != 2)
|
||||||
|
return CMD_RET_USAGE;
|
||||||
print_mmc_devices('\n');
|
print_mmc_devices('\n');
|
||||||
return 0;
|
return 0;
|
||||||
} else if (strcmp(argv[1], "dev") == 0) {
|
} else if (strcmp(argv[1], "dev") == 0) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue