main: invoke jtag_interface_quit() explicitly
authorØyvind Harboe <oyvind.harboe@zylin.com>
Mon, 30 Nov 2009 08:13:56 +0000 (09:13 +0100)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Tue, 1 Dec 2009 06:51:26 +0000 (07:51 +0100)
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.harboe@zylin.com>
src/openocd.c

index 1be209ad6a9b5b742d77c70feeaa491ceddac0af..22d45828ddc9f01cf5245c9504c2d27ebfdf2293 100644 (file)
@@ -60,10 +60,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)
 {
@@ -115,8 +111,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)
@@ -303,5 +297,7 @@ int openocd_main(int argc, char *argv[])
        /* free commandline interface */
        command_done(cmd_ctx);
 
+       jtag_interface_quit();
+
        return ret;
 }