X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Ftarget%2Fopenrisc%2For1k_du_adv.c;h=cfb7d0ef026a1b0169c13716a7c106f16e9c9836;hb=382148e4dd437978997d668f6ec715ddcec1c46e;hp=bdd6fc8cb943a1a566b39028b0cbffd19be254fc;hpb=d0e763ac7ef6aa17b17bd00ccdfbccfb4eacda69;p=fw%2Fopenocd diff --git a/src/target/openrisc/or1k_du_adv.c b/src/target/openrisc/or1k_du_adv.c index bdd6fc8cb..cfb7d0ef0 100644 --- a/src/target/openrisc/or1k_du_adv.c +++ b/src/target/openrisc/or1k_du_adv.c @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + /*************************************************************************** * Copyright (C) 2013-2014 by Franck Jullien * * elec4fun@gmail.com * @@ -9,19 +11,6 @@ * And the Mohor interface version of this file which is: * * Copyright (C) 2011 by Julius Baxter * * julius@opencores.org * - * * - * 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 . * ***************************************************************************/ #ifdef HAVE_CONFIG_H @@ -869,7 +858,7 @@ static int or1k_adv_cpu_reset(struct or1k_jtag *jtag_info, int action) static int or1k_adv_jtag_read_memory(struct or1k_jtag *jtag_info, uint32_t addr, uint32_t size, int count, uint8_t *buffer) { - LOG_DEBUG("Reading WB%" PRId32 " at 0x%08" PRIx32, size * 8, addr); + LOG_DEBUG("Reading WB%" PRIu32 " at 0x%08" PRIx32, size * 8, addr); int retval; if (!jtag_info->or1k_jtag_inited) { @@ -924,7 +913,7 @@ static int or1k_adv_jtag_read_memory(struct or1k_jtag *jtag_info, static int or1k_adv_jtag_write_memory(struct or1k_jtag *jtag_info, uint32_t addr, uint32_t size, int count, const uint8_t *buffer) { - LOG_DEBUG("Writing WB%" PRId32 " at 0x%08" PRIx32, size * 8, addr); + LOG_DEBUG("Writing WB%" PRIu32 " at 0x%08" PRIx32, size * 8, addr); int retval; if (!jtag_info->or1k_jtag_inited) { @@ -946,7 +935,7 @@ static int or1k_adv_jtag_write_memory(struct or1k_jtag *jtag_info, struct target *target = jtag_info->target; if ((target->endianness == TARGET_BIG_ENDIAN) && (size != 1)) { t = malloc(count * size * sizeof(uint8_t)); - if (t == NULL) { + if (!t) { LOG_ERROR("Out of memory"); return ERROR_FAIL; } @@ -975,8 +964,7 @@ static int or1k_adv_jtag_write_memory(struct or1k_jtag *jtag_info, size, blocks_this_round, block_count_address); if (retval != ERROR_OK) { - if (t != NULL) - free(t); + free(t); return retval; } @@ -985,9 +973,7 @@ static int or1k_adv_jtag_write_memory(struct or1k_jtag *jtag_info, block_count_buffer += size * MAX_BURST_SIZE; } - if (t != NULL) - free(t); - + free(t); return ERROR_OK; } @@ -995,7 +981,7 @@ int or1k_adv_jtag_jsp_xfer(struct or1k_jtag *jtag_info, int *out_len, unsigned char *out_buffer, int *in_len, unsigned char *in_buffer) { - LOG_DEBUG("JSP transfert"); + LOG_DEBUG("JSP transfer"); int retval; if (!jtag_info->or1k_jtag_inited)