]> git.sur5r.net Git - openocd/commitdiff
ARMv7-A: remove useless switch construct
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tue, 9 Dec 2014 10:11:30 +0000 (11:11 +0100)
committerPaul Fertser <fercerpav@gmail.com>
Wed, 28 Jan 2015 06:57:57 +0000 (06:57 +0000)
The default label does just return the same error code as the case for
zero, so this can be handled by a simple if statement.

Change-Id: I61a8cb51b5e261f21eca386af7d8cbf17ffa2d44
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-on: http://openocd.zylin.com/2430
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
src/target/armv7a.c

index 57b8799f0c8f301e7b0cc3ecadd16aa89379b7b0..ca599eb68ab01abcc4c46cea904d7faa14700ae9 100644 (file)
@@ -564,21 +564,17 @@ COMMAND_HANDLER(handle_cache_l2x)
 {
        struct target *target = get_current_target(CMD_CTX);
        uint32_t base, way;
-       switch (CMD_ARGC) {
-               case 0:
-                       return ERROR_COMMAND_SYNTAX_ERROR;
-                       break;
-               case 2:
-                       /* command_print(CMD_CTX, "%s %s", CMD_ARGV[0], CMD_ARGV[1]); */
-                       COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], base);
-                       COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], way);
-
-                       /* AP address is in bits 31:24 of DP_SELECT */
-                       armv7a_l2x_cache_init(target, base, way);
-                       break;
-               default:
-                       return ERROR_COMMAND_SYNTAX_ERROR;
-       }
+
+       if (CMD_ARGC != 2)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
+       /* command_print(CMD_CTX, "%s %s", CMD_ARGV[0], CMD_ARGV[1]); */
+       COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], base);
+       COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], way);
+
+       /* AP address is in bits 31:24 of DP_SELECT */
+       armv7a_l2x_cache_init(target, base, way);
+
        return ERROR_OK;
 }