fix tapenabler return code
authorRodrigo L. Rosa <rodrigorosa.LG@gmail.com>
Tue, 9 Aug 2011 18:25:23 +0000 (11:25 -0700)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Tue, 9 Aug 2011 18:59:40 +0000 (20:59 +0200)
if tap enable/disable failed then a warning was written to the log, but JIM_OK was returned. if using openocd via a TCP interface to the TCL port, there is no way to catch that the command failed (it didn't enable the tap, so it failed)
now it return an error if it fails.

src/jtag/tcl.c

index 267802edc86f389211979bab0b9148162f773c3a..3b2f83b5aef4b6a3c063cdf2ba82b1c6a9cd4d34 100644 (file)
@@ -774,11 +774,15 @@ static int jim_jtag_tap_enabler(Jim_Interp *interp, int argc, Jim_Obj *const *ar
        if (strcasecmp(cmd_name, "tapisenabled") == 0) {
                // do nothing, just return the value
        } else if (strcasecmp(cmd_name, "tapenable") == 0) {
-               if (!jtag_tap_enable(t))
+               if (!jtag_tap_enable(t)){
                        LOG_WARNING("failed to enable tap %s", t->dotted_name);
+                        return JIM_ERR;
+                }
        } else if (strcasecmp(cmd_name, "tapdisable") == 0) {
-               if (!jtag_tap_disable(t))
+               if (!jtag_tap_disable(t)){
                        LOG_WARNING("failed to disable tap %s", t->dotted_name);
+                        return JIM_ERR;
+                }
        } else {
                LOG_ERROR("command '%s' unknown", cmd_name);
                return JIM_ERR;