X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Fxsvf%2Fxsvf.c;h=e574c6f0e42599769a2c1cc0412e652ae1889587;hb=HEAD;hp=53779bb1cd6bf9698b59a13db6e430c16e2e7258;hpb=890048eec4f955c43284626e9c8841441e85f4fc;p=openocd.git diff --git a/src/xsvf/xsvf.c b/src/xsvf/xsvf.c index 53779bb1cd..0266c2120c 100644 --- a/src/xsvf/xsvf.c +++ b/src/xsvf/xsvf.c @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + /*************************************************************************** * Copyright (C) 2005 by Dominic Rath * * Dominic.Rath@gmx.de * @@ -10,19 +12,6 @@ * * * Copyright (C) 2009 SoftPLC Corporation. http://softplc.com * * Dick Hollenbeck * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * ***************************************************************************/ /* The specification for SVF is available here: @@ -39,6 +28,7 @@ #endif #include "xsvf.h" +#include "helper/system.h" #include #include @@ -411,12 +401,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); @@ -489,7 +476,7 @@ COMMAND_HANDLER(handle_xsvf_command) field.out_value = dr_out_buf; field.in_value = calloc(DIV_ROUND_UP(field.num_bits, 8), 1); - if (tap == NULL) + if (!tap) jtag_add_plain_dr_scan(field.num_bits, field.out_value, field.in_value, @@ -698,7 +685,7 @@ COMMAND_HANDLER(handle_xsvf_command) field.in_value = NULL; - if (tap == NULL) + if (!tap) jtag_add_plain_ir_scan(field.num_bits, field.out_value, field.in_value, my_end_state); else @@ -932,7 +919,7 @@ COMMAND_HANDLER(handle_xsvf_command) if (attempt > 0 && verbose) LOG_USER("LSDR retry %d", attempt); - if (tap == NULL) + if (!tap) jtag_add_plain_dr_scan(field.num_bits, field.out_value, field.in_value, @@ -1027,14 +1014,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); @@ -1064,7 +1046,7 @@ int xsvf_register_commands(struct command_context *cmd_ctx) /* -PSUEDO-Code from Xilinx Appnote XAPP067.pdf : +PSEUDO-Code from Xilinx Appnote XAPP067.pdf : the following pseudo code clarifies the intent of the xrepeat support.The flow given is for the entire processing of an SVF file, not an XSVF file.