Cleanup of config/includes.
[fw/openocd] / src / xsvf / xsvf.c
index bec32f21ef8b20e37096381a1be5d0ee9d2f4b82..2a7b56dbf4d80e5e6951eb38ce94ba3395bf6a2c 100644 (file)
 
 /* The specification for SVF is available here:
  * http://www.asset-intertech.com/support/svf.pdf
- * Below, this document is refered to as the "SVF spec".
+ * Below, this document is referred to as the "SVF spec".
  *
  * The specification for XSVF is available here:
  * http://www.xilinx.com/support/documentation/application_notes/xapp503.pdf
- * Below, this document is refered to as the "XSVF spec".
+ * Below, this document is referred to as the "XSVF spec".
  */
 
 #ifdef HAVE_CONFIG_H
@@ -39,6 +39,7 @@
 #endif
 
 #include "xsvf.h"
+#include "helper/system.h"
 #include <jtag/jtag.h>
 #include <svf/svf.h>
 
@@ -230,7 +231,7 @@ COMMAND_HANDLER(handle_xsvf_command)
        unsigned pathlen = 0;
 
        /* a flag telling whether to clock TCK during waits,
-        * or simply sleep, controled by virt2
+        * or simply sleep, controlled by virt2
         */
        int runtest_requires_tck = 0;
 
@@ -411,12 +412,9 @@ COMMAND_HANDLER(handle_xsvf_command)
                                xsdrsize = be_to_h_u32(xsdrsize_buf);
                                LOG_DEBUG("XSDRSIZE %d", xsdrsize);
 
-                               if (dr_out_buf)
-                                       free(dr_out_buf);
-                               if (dr_in_buf)
-                                       free(dr_in_buf);
-                               if (dr_in_mask)
-                                       free(dr_in_mask);
+                               free(dr_out_buf);
+                               free(dr_in_buf);
+                               free(dr_in_mask);
 
                                dr_out_buf = malloc((xsdrsize + 7) / 8);
                                dr_in_buf = malloc((xsdrsize + 7) / 8);
@@ -456,7 +454,7 @@ COMMAND_HANDLER(handle_xsvf_command)
 
                                        if (attempt > 0) {
                                                /* perform the XC9500 exception handling sequence shown in xapp067.pdf and
-                                                * illustrated in psuedo code at end of this file.  We start from state
+                                                * illustrated in pseudo code at end of this file.  We start from state
                                                 * DRPAUSE:
                                                 * go to Exit2-DR
                                                 * go to Shift-DR
@@ -1027,14 +1025,9 @@ COMMAND_HANDLER(handle_xsvf_command)
                return ERROR_FAIL;
        }
 
-       if (dr_out_buf)
-               free(dr_out_buf);
-
-       if (dr_in_buf)
-               free(dr_in_buf);
-
-       if (dr_in_mask)
-               free(dr_in_mask);
+       free(dr_out_buf);
+       free(dr_in_buf);
+       free(dr_in_mask);
 
        close(xsvf_fd);