From ddecadca42ce392ca10da56a6c273e8041299ef0 Mon Sep 17 00:00:00 2001 From: Tomek CEDRO Date: Tue, 13 Nov 2012 02:26:27 +0100 Subject: [PATCH] Initialization is marked as initialized after all initializations are done, not before. When something goes wrong and the function cannot handle errors user still can change the parameters and try to reinitialize environment. Change-Id: I04cd8bf892ff42f57567b4b5b3bd6ddeaa3406aa Signed-off-by: Tomek CEDRO --- src/openocd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openocd.c b/src/openocd.c index f09307736..e56a3ae55 100644 --- a/src/openocd.c +++ b/src/openocd.c @@ -118,8 +118,6 @@ COMMAND_HANDLER(handle_init_command) if (initialized) return ERROR_OK; - initialized = 1; - retval = command_run_line(CMD_CTX, "target init"); if (ERROR_OK != retval) return ERROR_FAIL; @@ -167,6 +165,8 @@ COMMAND_HANDLER(handle_init_command) target_register_event_callback(log_target_callback_event_handler, CMD_CTX); + initialized = 1; + return ERROR_OK; } -- 2.11.4.GIT