cortex_a: use the ap number specified at target create
[fw/openocd] / src / openocd.c
index 2eb7346c5705b036de3329119fcefa946937d104..b4571b46499e9c6781c027be68c60c0221c7c81d 100644 (file)
@@ -262,7 +262,7 @@ static struct command_context *setup_command_handler(Jim_Interp *interp)
                &arm_tpiu_swo_register_commands,
                NULL
        };
-       for (unsigned i = 0; NULL != command_registrants[i]; i++) {
+       for (unsigned i = 0; command_registrants[i]; i++) {
                int retval = (*command_registrants[i])(cmd_ctx);
                if (retval != ERROR_OK) {
                        command_done(cmd_ctx);
@@ -364,8 +364,8 @@ int openocd_main(int argc, char *argv[])
        help_del_all_commands(cmd_ctx);
 
        /* free all DAP and CTI objects */
-       dap_cleanup_all();
        arm_cti_cleanup_all();
+       dap_cleanup_all();
 
        adapter_quit();