summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>2020-03-20 19:38:17 +0300
committerTom Rini <trini@konsulko.com>2020-04-27 14:55:29 -0400
commit5f2c4e0129bf644dbde3c75119406eceaded2aa2 (patch)
treec73fd3853c848668d34ee8534dc581bf72a4e940 /cmd
parentd16d37bcd4087b8ea0f66cb76a73edad182d151a (diff)
downloadu-boot-5f2c4e0129bf644dbde3c75119406eceaded2aa2.tar.gz
u-boot-5f2c4e0129bf644dbde3c75119406eceaded2aa2.tar.bz2
u-boot-5f2c4e0129bf644dbde3c75119406eceaded2aa2.zip
CMD: random: fix return code
As of today 'random' command return 1 (CMD_RET_FAILURE) in case of successful execution and 0 (CMD_RET_SUCCESS) in case of bad arguments. Fix that. NOTE: we remove printing usage information from command body so it won't print twice. Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/mem.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/cmd/mem.c b/cmd/mem.c
index 0bfb6081e7..009b7b58f3 100644
--- a/cmd/mem.c
+++ b/cmd/mem.c
@@ -1144,10 +1144,8 @@ static int do_random(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
unsigned char *buf8;
unsigned int i;
- if (argc < 3 || argc > 4) {
- printf("usage: %s <addr> <len> [<seed>]\n", argv[0]);
- return 0;
- }
+ if (argc < 3 || argc > 4)
+ return CMD_RET_USAGE;
len = simple_strtoul(argv[2], NULL, 16);
addr = simple_strtoul(argv[1], NULL, 16);
@@ -1174,7 +1172,8 @@ static int do_random(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
unmap_sysmem(start);
printf("%lu bytes filled with random data\n", len);
- return 1;
+
+ return CMD_RET_SUCCESS;
}
#endif