xsvf: add missing error propagation
authorØyvind Harboe <oyvind.harboe@zylin.com>
Mon, 7 Nov 2011 06:24:42 +0000 (07:24 +0100)
committerSpencer Oliver <spen@spen-soft.co.uk>
Mon, 7 Nov 2011 20:35:42 +0000 (20:35 +0000)
Change-Id: Ibc70deb980d6d18ceb376b72d9104e6180b16acf
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/176
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
src/xsvf/xsvf.c

index 31c3949..14b9e28 100644 (file)
@@ -510,14 +510,19 @@ COMMAND_HANDLER(handle_xsvf_command)
                                if (xruntest)
                                {
                                        result = svf_add_statemove(TAP_IDLE);
+                                       if (result != ERROR_OK)
+                                               return result;
 
                                        if (runtest_requires_tck)
                                                jtag_add_clocks(xruntest);
                                        else
                                                jtag_add_sleep(xruntest);
-                               }
-                               else if (xendir != TAP_DRPAUSE) /* we are already in TAP_DRPAUSE */
+                               } else if (xendir != TAP_DRPAUSE) {
+                                       /* we are already in TAP_DRPAUSE */
                                        result = svf_add_statemove(xenddr);
+                                       if (result != ERROR_OK)
+                                               return result;
+                               }
                        }
                        break;
 
@@ -790,8 +795,12 @@ COMMAND_HANDLER(handle_xsvf_command)
                                {
                                        /* FIXME handle statemove errors ... */
                                        result = svf_add_statemove(wait_state);
+                                       if (result != ERROR_OK)
+                                               return result;
                                        jtag_add_sleep(delay);
                                        result = svf_add_statemove(end_state);
+                                       if (result != ERROR_OK)
+                                               return result;
                                }
                        }
                        break;
@@ -846,12 +855,16 @@ COMMAND_HANDLER(handle_xsvf_command)
 
                                /* FIXME handle statemove errors ... */
                                result = svf_add_statemove(wait_state);
+                               if (result != ERROR_OK)
+                                       return result;
 
                                jtag_add_clocks(clock_count);
 
                                jtag_add_sleep(usecs);
 
                                result = svf_add_statemove(end_state);
+                               if (result != ERROR_OK)
+                                       return result;
                        }
                        break;
 
@@ -925,6 +938,8 @@ COMMAND_HANDLER(handle_xsvf_command)
                                        struct scan_field field;
 
                                        result = svf_add_statemove(loop_state);
+                                       if (result != ERROR_OK)
+                                               return result;
                                        jtag_add_clocks(loop_clocks);
                                        jtag_add_sleep(loop_usecs);
 
@@ -1003,7 +1018,11 @@ COMMAND_HANDLER(handle_xsvf_command)
 
                        /* upon error, return the TAPs to a reasonable state */
                        result = svf_add_statemove(TAP_IDLE);
+                       if (result != ERROR_OK)
+                               return result;
                        result = jtag_execute_queue();
+                       if (result != ERROR_OK)
+                               return result;
                        break;
                }
        }