mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-02-17 22:49:02 +00:00
cmd: blk_common: Use macros for the return values
Avoid using magic number 0/1 for the command result. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
parent
cf83ff3452
commit
8ccc948f40
1 changed files with 7 additions and 7 deletions
|
@ -25,18 +25,18 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id uclass_id,
|
||||||
case 2:
|
case 2:
|
||||||
if (strncmp(argv[1], "inf", 3) == 0) {
|
if (strncmp(argv[1], "inf", 3) == 0) {
|
||||||
blk_list_devices(uclass_id);
|
blk_list_devices(uclass_id);
|
||||||
return 0;
|
return CMD_RET_SUCCESS;
|
||||||
} else if (strncmp(argv[1], "dev", 3) == 0) {
|
} else if (strncmp(argv[1], "dev", 3) == 0) {
|
||||||
if (blk_print_device_num(uclass_id, *cur_devnump)) {
|
if (blk_print_device_num(uclass_id, *cur_devnump)) {
|
||||||
printf("\nno %s devices available\n", if_name);
|
printf("\nno %s devices available\n", if_name);
|
||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
}
|
}
|
||||||
return 0;
|
return CMD_RET_SUCCESS;
|
||||||
} else if (strncmp(argv[1], "part", 4) == 0) {
|
} else if (strncmp(argv[1], "part", 4) == 0) {
|
||||||
if (blk_list_part(uclass_id))
|
if (blk_list_part(uclass_id))
|
||||||
printf("\nno %s partition table available\n",
|
printf("\nno %s partition table available\n",
|
||||||
if_name);
|
if_name);
|
||||||
return 0;
|
return CMD_RET_SUCCESS;
|
||||||
}
|
}
|
||||||
return CMD_RET_USAGE;
|
return CMD_RET_USAGE;
|
||||||
case 3:
|
case 3:
|
||||||
|
@ -49,7 +49,7 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id uclass_id,
|
||||||
} else {
|
} else {
|
||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
}
|
}
|
||||||
return 0;
|
return CMD_RET_SUCCESS;
|
||||||
} else if (strncmp(argv[1], "part", 4) == 0) {
|
} else if (strncmp(argv[1], "part", 4) == 0) {
|
||||||
int dev = (int)dectoul(argv[2], NULL);
|
int dev = (int)dectoul(argv[2], NULL);
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id uclass_id,
|
||||||
if_name, dev);
|
if_name, dev);
|
||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
}
|
}
|
||||||
return 0;
|
return CMD_RET_SUCCESS;
|
||||||
}
|
}
|
||||||
return CMD_RET_USAGE;
|
return CMD_RET_USAGE;
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id uclass_id,
|
||||||
|
|
||||||
printf("%ld blocks read: %s\n", n,
|
printf("%ld blocks read: %s\n", n,
|
||||||
n == cnt ? "OK" : "ERROR");
|
n == cnt ? "OK" : "ERROR");
|
||||||
return n == cnt ? 0 : 1;
|
return n == cnt ? CMD_RET_SUCCESS : CMD_RET_FAILURE;
|
||||||
} else if (strcmp(argv[1], "write") == 0) {
|
} else if (strcmp(argv[1], "write") == 0) {
|
||||||
phys_addr_t paddr = hextoul(argv[2], NULL);
|
phys_addr_t paddr = hextoul(argv[2], NULL);
|
||||||
lbaint_t blk = hextoul(argv[3], NULL);
|
lbaint_t blk = hextoul(argv[3], NULL);
|
||||||
|
@ -98,7 +98,7 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id uclass_id,
|
||||||
|
|
||||||
printf("%ld blocks written: %s\n", n,
|
printf("%ld blocks written: %s\n", n,
|
||||||
n == cnt ? "OK" : "ERROR");
|
n == cnt ? "OK" : "ERROR");
|
||||||
return n == cnt ? 0 : 1;
|
return n == cnt ? CMD_RET_SUCCESS : CMD_RET_FAILURE;
|
||||||
} else {
|
} else {
|
||||||
return CMD_RET_USAGE;
|
return CMD_RET_USAGE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue