]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
Add validation for icache/dcache arguments - arguments different from off/on/flush...
authorEric Perie <eric.perie@yahoo.com>
Sat, 13 Jul 2019 18:54:58 +0000 (14:54 -0400)
committerTom Rini <trini@konsulko.com>
Mon, 29 Jul 2019 13:32:13 +0000 (09:32 -0400)
Signed-off-by: Eric Perie <eric.perie@yahoo.com>
cmd/cache.c

index 233f428054e5d79bd56f2965360e3957ab3f924a..2c687173a8bfe5ddc45e73a61089cc17230dd929 100644 (file)
@@ -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 */