aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/openocd.c4
-rw-r--r--src/target/target.c6
2 files changed, 6 insertions, 4 deletions
diff --git a/src/openocd.c b/src/openocd.c
index 2c27fc4..66555e6 100644
--- a/src/openocd.c
+++ b/src/openocd.c
@@ -292,10 +292,6 @@ static int openocd_thread(int argc, char *argv[], struct command_context *cmd_ct
if (ERROR_OK != ret)
return EXIT_FAILURE;
- ret = command_run_line(cmd_ctx, "init_targets");
- if (ERROR_OK != ret)
- ret = EXIT_FAILURE;
-
if (init_at_startup)
{
ret = command_run_line(cmd_ctx, "init");
diff --git a/src/target/target.c b/src/target/target.c
index 4708a1d..bcd00a1 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -1043,6 +1043,8 @@ static int target_init(struct command_context *cmd_ctx)
COMMAND_HANDLER(handle_target_init_command)
{
+ int retval;
+
if (CMD_ARGC != 0)
return ERROR_COMMAND_SYNTAX_ERROR;
@@ -1054,6 +1056,10 @@ COMMAND_HANDLER(handle_target_init_command)
}
target_initialized = true;
+ retval = command_run_line(CMD_CTX, "init_targets");
+ if (ERROR_OK != retval)
+ return retval;
+
LOG_DEBUG("Initializing targets...");
return target_init(CMD_CTX);
}