There is no particular reason to invoke jtag_interface_quit()
on the atexit() handler, it just makes the code more obtuse
and stops other legitimate usage of atexit().

Signed-off-by: Øyvind Harboe <oyvind.har...@zylin.com>
---
 src/openocd.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/src/openocd.c b/src/openocd.c
index 01e9e79..6ec97f5 100644
--- a/src/openocd.c
+++ b/src/openocd.c
@@ -62,10 +62,6 @@ COMMAND_HANDLER(handle_version_command)
        return ERROR_OK;
 }
 
-static void exit_handler(void)
-{
-       jtag_interface_quit();
-}
 
 static int log_target_callback_event_handler(struct target *target, enum 
target_event event, void *priv)
 {
@@ -107,8 +103,6 @@ COMMAND_HANDLER(handle_init_command)
 
        initialized = 1;
 
-       atexit(exit_handler);
-
        command_context_mode(CMD_CTX, COMMAND_EXEC);
 
        if (target_init(CMD_CTX) != ERROR_OK)
@@ -288,6 +282,7 @@ int openocd_main(int argc, char *argv[])
        /* free commandline interface */
        command_done(cmd_ctx);
 
+       jtag_interface_quit();
 
        return EXIT_SUCCESS;
 }
-- 
1.6.3.3

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to