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>
diff --git a/cmd/cache.c b/cmd/cache.c
index 233f428..2c68717 100644
--- a/cmd/cache.c
+++ b/cmd/cache.c
@@ -22,7 +22,7 @@
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 @@
case 2:
invalidate_icache_all();
break;
+ default:
+ return CMD_RET_USAGE;
}
break;
case 1: /* get status */
@@ -54,7 +56,7 @@
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 @@
case 2:
flush_dcache_all();
break;
+ default:
+ return CMD_RET_USAGE;
}
break;
case 1: /* get status */