diff options
author | Eric Perie <eric.perie@yahoo.com> | 2019-07-13 14:54:58 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-07-29 09:32:13 -0400 |
commit | f043dc28e3cce115089fb9ab86bc6f4bc4a8a882 (patch) | |
tree | ba7079b5d3e432320715956c535c529960c4486f /cmd/cache.c | |
parent | a1b633df55d5207b49ce145ede783d671385854c (diff) | |
download | u-boot-f043dc28e3cce115089fb9ab86bc6f4bc4a8a882.tar.gz u-boot-f043dc28e3cce115089fb9ab86bc6f4bc4a8a882.tar.bz2 u-boot-f043dc28e3cce115089fb9ab86bc6f4bc4a8a882.zip |
Add validation for icache/dcache arguments - arguments different from off/on/flush are currently silently ignored.
Signed-off-by: Eric Perie <eric.perie@yahoo.com>
Diffstat (limited to 'cmd/cache.c')
-rw-r--r-- | cmd/cache.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cmd/cache.c b/cmd/cache.c index 233f428054..2c687173a8 100644 --- a/cmd/cache.c +++ b/cmd/cache.c @@ -22,7 +22,7 @@ void __weak invalidate_icache_all(void) static int do_icache(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { switch (argc) { - case 2: /* on / off */ + case 2: /* on / off / flush */ switch (parse_argv(argv[1])) { case 0: icache_disable(); @@ -33,6 +33,8 @@ static int do_icache(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) case 2: invalidate_icache_all(); break; + default: + return CMD_RET_USAGE; } break; case 1: /* get status */ @@ -54,7 +56,7 @@ void __weak flush_dcache_all(void) static int do_dcache(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { switch (argc) { - case 2: /* on / off */ + case 2: /* on / off / flush */ switch (parse_argv(argv[1])) { case 0: dcache_disable(); @@ -65,6 +67,8 @@ static int do_dcache(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) case 2: flush_dcache_all(); break; + default: + return CMD_RET_USAGE; } break; case 1: /* get status */ |