]> git.sur5r.net Git - openocd/commitdiff
Simplify and fix target handle_rwp_command routine:
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Thu, 11 Jun 2009 11:42:47 +0000 (11:42 +0000)
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Thu, 11 Jun 2009 11:42:47 +0000 (11:42 +0000)
- Return syntax error unless exactly one argument is passed.
- Move variable declaration to point of first use.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2193 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/target/target.c

index b207ac95adb3d6cae733da84b1c4d4923903ca54..ea187ea543e9ce8cb4c092b559ad93e69e9793fe 100644 (file)
@@ -2566,10 +2566,11 @@ static int handle_wp_command(struct command_context_s *cmd_ctx, char *cmd, char
 
 static int handle_rwp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
 {
-       target_t *target = get_current_target(cmd_ctx);
+       if (argc != 1)
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
-       if (argc > 0)
-               watchpoint_remove(target, strtoul(args[0], NULL, 0));
+       target_t *target = get_current_target(cmd_ctx);
+       watchpoint_remove(target, strtoul(args[0], NULL, 0));
 
        return ERROR_OK;
 }