aboutsummaryrefslogtreecommitdiff
path: root/src/target
AgeCommit message (Collapse)Author
2019-04-07command_registration: add empty usage field to chained commandsAntonio Borneo
Chained command require a subcommand as first argument. The usage field for chained commands is not really important because the "help" command will list all the subcommands with their respective usage. Add a empty usage field on all chained command. The command "jlink config" can be either followed by a subcommand or used alone, so use a dedicated usage string. Change-Id: I43c3f8a766f96a9bdab4e709e3c90713be41fcef Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5017 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-07target/armv7a: simplify help description of command "l2x"Antonio Borneo
There is no need to split the string in two lines. Change-Id: Ifc574904acd06c31fab589643334e86f4dd0a122 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5016 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-07target/riscv: use coherent syntax in struct initializationAntonio Borneo
While initializing struct command_registration, the field's name "name" is not specified, thus relying on the fact that it is the first field declared in the struct and it's initialization value can be listed as the first one. Be coherent in the struct initialization and always use the field's name. Change-Id: Iefaeb15cc051db9f1e0f0140fe2f231b45f5bb12 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5013 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins Reviewed-by: Tim Newsome <tim@sifive.com>
2019-04-07target/openrisc: use coherent syntax in struct initializationAntonio Borneo
While initializing struct command_registration, the field's name "name" is not specified, thus relying on the fact that it is the first field declared in the struct and it's initialization value can be listed as the first one. Be coherent in the struct initialization and always use the field's name. Change-Id: I65d32870bf4d3df845db69682fe445c71642f976 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5012 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2019-04-07target/armv4_5: use coherent syntax in struct initializationAntonio Borneo
While initializing struct command_registration, the field's name "name" is not specified, thus relying on the fact that it is the first field declared in the struct and it's initialization value can be listed as the first one. Be coherent in the struct initialization and always use the field's name. Change-Id: I9ef7ac08e7cd5b82a6a7896c47017943d668925f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5011 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2019-04-07target/arm7_9_common: use coherent syntax in struct initializationAntonio Borneo
While initializing struct command_registration, the field's name "name" is not specified, thus relying on the fact that it is the first field declared in the struct and it's initialization value can be listed as the first one. Be coherent in the struct initialization and always use the field's name. Change-Id: I743457acf7757df4646c9bc4e5ea1a6f9c841516 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5010 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2019-04-03target/arm_adi_v5: fix typoMete Balci
Fixed the small typo. Change-Id: Ia8834b23302d25e92cb2fa0802bebb2a9416595b Signed-off-by: Mete Balci <metebalci@gmail.com> Reviewed-on: http://openocd.zylin.com/5001 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-04-03armv7a_mmu: Remove warning on va = paFlorian Fainelli
Depending on how the MMU is configured it is possible to have a 1:1 mapping between virtual and physical addresses, thus making this warning bogus. We already check that the MMU is enabled in the caller: cortex_a_virt2phys(). Change-Id: I09f4c53ef933c8d1e268da5215a769449be014bc Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-on: http://openocd.zylin.com/5007 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Kamal Dasu <kdasu.kdev@gmail.com> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2019-04-03target/cortex_m: remove target halted check when removing a breakpointTomas Vanek
Remove the target halted check from cortex_m_remove_breakpoint() as there is no such check in cortex_m_set_breakpoint() and bp can be safely removed from the running target. While on it return the error code from cortex_m_unset_breakpoint() to higher level. Change-Id: I2b358c3661feed84297913e9f589bdf1e4de7e64 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4887 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de> Reviewed-by: Jānis Skujenieks <janis.skujenieks@gmail.com> Reviewed-by: Christopher Head <chead@zaber.com>
2019-04-01target/cortex_m: remove fp_code_available countingTomas Vanek
fp_code_available looses sync with the real number of free comparators as soon as cortex_m_set_breakpoint() returns an error. Remove the counter and always go through the fp_comparator_list to find a free one. Change-Id: I9f6e06c36d8a57ad11df5155e8a1a3aff6d833a5 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4870 Tested-by: jenkins Reviewed-by: Jānis Skujenieks <janis.skujenieks@gmail.com> Reviewed-by: Christopher Head <chead@zaber.com> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2019-04-01target/cortex_m: simplify cortex_m_unset_breakpoint()Tomas Vanek
Cortex-M uses only 2 byte breakpoint instruction. cortex_m_unset_breakpoint() does not need to check breakpoint->length, use the length as the size argument in target_write_memory() Change-Id: I20bb869f6abce2fc61f0469e34a638bc4dc6f7ce Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4889 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de> Reviewed-by: Jānis Skujenieks <janis.skujenieks@gmail.com> Reviewed-by: Christopher Head <chead@zaber.com>
2019-03-27smp: move sub-command "smp_gdb" in file smp.cAntonio Borneo
The code for this command is currently replicated in cortex_a and in mips_m4k and is going to be added again for cortex_m. Plus, it is going to be obsoleted by the HW thread pseudo RTOS. Consolidate in smp.c a single instance of the command. This will simplify both obsoleting it and adding it to cortex_m, whatever change comes first. Change-Id: I03cd857e21fa3f7202fdcee36bcbd5aae30a609d Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4991 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2019-03-27smp: replace commands smp_on/smp_off with "smp [on|off]"Antonio Borneo
Seams over-engineered having two separate commands to turn SMP on/off. Plus it is missing the possibility to dump the current status of SMP and would be weird adding an additional command for it. Moreover, such commands are replicated in few targets so it would make sense centralizing them. - Deprecate the commands "smp_on" and "smp_off". - Add a new command "smp" that accepts optional parameters "[on|off]" and prints the SMP status when run without parameters. This replaces the two commands above. - Put the deprecated and the new command handlers in smp.c - Update the documentation, except for mips_m4k, since it is not available yet. - Promote the macro foreach_smp_target to global context and use it where possible. Change-Id: Ia72841c1a3bd6edd4db4cc809046322f498617e6 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4615 Tested-by: jenkins Reviewed-by: Graham Sanderson <graham.sanderson@gmail.com> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2019-03-27Lots of RISC-V improvements.Tim Newsome
This represents months of continuing RISC-V work, with too many changes to list individually. Some improvements: * Fixed memory leaks. * Better handling of dbus timeouts. * Add `riscv expose_custom` command. * Somewhat deal with cache coherency. * Deal with more timeouts during block memory accesses. * Basic debug compliance test. * Tell gdb which watchpoint hit. * SMP support for use with -rtos hwthread * Add `riscv set_ir` Change-Id: Ica507ee2a57eaf51b578ab1d9b7de71512fdf47f Signed-off-by: Tim Newsome <tim@sifive.com> Reviewed-on: http://openocd.zylin.com/4922 Tested-by: jenkins Reviewed-by: Philipp Guehring <pg@futureware.at> Reviewed-by: Liviu Ionescu <ilg@livius.net> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2019-03-23mips32: pracc: Fix indentMarek Vasut
Fix indent of the macros in header file, no functional change. Change-Id: I4d1dba5725155200148d1543c45bad919f6cd37e Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Reviewed-on: http://openocd.zylin.com/4995 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2019-03-23mips32: pracc: Fix UPPER/LOWER macrosMarek Vasut
These macros are missing parenthesis around the argument, which can lead to side effects, add them. Replace the argument name to avoid conflict with uint32_t data type, since the macro can be applied to other data types as well. Change-Id: I32d2ffec6c062795d7c8bb23d1dfa3378bfc3a58 Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Reviewed-on: http://openocd.zylin.com/4994 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2019-03-14target/mips: Use 'bool' data typeMarc Schink
Change-Id: Ifb114bfc062ed7c0ff6e4f37a1a6d546f5415344 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4970 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-03-14target/xscale: Use 'bool' data typeMarc Schink
Change-Id: I4e117f4e6c8c0850f565587f68f41d88da0d6b0b Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4968 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-03-14target/dsp563xx: Use 'bool' data typeMarc Schink
Change-Id: Ie7ee82bf04c76ef899ae8b19105158e71b69ae2c Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4962 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-03-14target/adi_v5_swd: improve error check while updating DP_SELECTAntonio Borneo
Write to register DP_SELECT can fail, but both functions swd_queue_dp_bankselect() and swd_queue_ap_bankselect() return void and do not propagate the error. Change the return type of the two functions to int and check the returned value. Invalidate the cached value of DP_SELECT if the write fails. Change-Id: Iba6ef8b0c2332e7f7efb66337d558fb7a4a0d39c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4980 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-03-14target/adi_v5_swd: update cached value on write to DP_SELECTAntonio Borneo
When the register DP_SELECT is written directly, e.g. with command <dap> dpreg 8 <value> the cached value in OpenOCD is not completely updated with the new value, thus creating issues in the following AP and DP read/write that rely on the cached value. Update the cached value while writing to DP_SELECT. Change-Id: I8221b10cd6fc1fbe73e6b834b68820b43480e1a2 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4979 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-03-12target/breakpoints: make internal functions staticTomas Vanek
While on it add two missing new lines. Change-Id: I0d54740479bc462b734f91686f0931824796b598 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4888 Tested-by: jenkins Reviewed-by: Marc Schink <openocd-dev@marcschink.de>
2019-03-08gdb_server, target: Add target_address_bits()Tim Newsome
Targets can use this to expose how many address bits there are. gdb_server uses this to send gdb the appropriate upper limit in the memory-map. (Before this change the upper limit would only be correct for 32-bit targets.) Change-Id: Idb0933255ed53951fcfb05e040674bcdf19441e1 Signed-off-by: Tim Newsome <tim@sifive.com> Reviewed-on: http://openocd.zylin.com/4947 Tested-by: jenkins Reviewed-by: Peter Mamonov <pmamonov@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-03-06target/openrisc/x86_32_common: Use 'bool' data typeMarc Schink
Change-Id: I395a36ddd7ac7e85bc54f6bb073a93b0c6f24db0 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4972 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-03-06target/openrisc/or1k: Use 'bool' data typeMarc Schink
Change-Id: I6393bb8503d64947a1f2349e1d14c1552cabf927 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4971 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-03-06target/lakemont: Use 'bool' data typeMarc Schink
Change-Id: I9baaf617c2bfabd07ac3ca195e486893d7950398 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4969 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-03-06target/feroceon: Use 'bool' data typeMarc Schink
Change-Id: I30b8d07ee198e8f67cd98f83c4bec15bcfe8be08 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4967 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-03-06target/etb: Use 'bool' data typeMarc Schink
Change-Id: I536036b15af10bb1879dbbec84576134fd3dce35 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4966 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-03-06target/arm_semihosting: Use 'bool' data typeMarc Schink
Change-Id: I05245b7dc9c37ea8e0e40672070fb3e87cb7683f Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4965 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-03-06target/embeddedice: Use 'bool' data typeMarc Schink
Change-Id: I0f237e0769786aa560d1a472a71499d3856ab25c Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4964 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-03-06target/cortex_a: Use 'bool' data typeMarc Schink
Change-Id: I055767f1c20af539159ee59e35de8dd20b399fa4 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4963 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-03-06target/avr32_ap7k: Use 'bool' data typeMarc Schink
Change-Id: I49f1a6c6ee6d175935eb40b49abf8ebdf56a0b6e Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4961 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-03-06target/arm926ejs: Use 'bool' data typeMarc Schink
Change-Id: I3016a8ba37942d674017c09e4540d9813c832872 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4960 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-03-06target/arm920t: Use 'bool' data typeMarc Schink
Change-Id: I5f2c95d9a4bdb14cc31d72eb026f58710fb07db5 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4959 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-03-06target/arm720t: Use 'bool' data typeMarc Schink
Change-Id: I9838d0d0ba472f029169ab37597ef367a6084fbf Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4958 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-03-06target/aarch64: Use 'bool' data typeMarc Schink
Change-Id: Ibfe4413b88ed0759a556a8777dac40f0c2c64922 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4957 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-03-06target/armv8: Use 'bool' data typeMarc Schink
Change-Id: I65def33f24187ab336db5732ce35200ca5cd8f5f Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4956 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-03-06target/armv7m: Use 'bool' data typeMarc Schink
Change-Id: I9cfbba9d81601cc72e2b54ec410e21c7edc4f1c4 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4955 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-03-06target/arm11: Use 'bool' data typeMarc Schink
Change-Id: Ia09adeab88eaf66c009f94be25ab82b0b8f88f61 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4954 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-03-06target/armv7_9_common: Use 'bool' data typeMarc Schink
Change-Id: I5af27247f39cf47c925260784e21292f34665471 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4953 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-03-06target/armv4_5: Use 'bool' data typeMarc Schink
Change-Id: I82e3963ea662844bb96943aee849dab35ea96bb3 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4952 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-03-06target/register: Use 'bool' data typeMarc Schink
Change-Id: I3633ced9cb2bfe6afb0ef49aa42fd1b54f155a66 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4951 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-03-06target/cortex_m: Use 'bool' instead of 'int'Marc Schink
Change-Id: I273d24997e2c844015e144a15981f8f0af522261 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4950 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-03-06target: Remove unused variable 'has_percent'Marc Schink
Change-Id: Ib080fc33e8a0305990ee334019547e7643c446ac Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4949 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-03-04armv8: allow halt on exceptionMatthias Welwarsky
add command 'catch_exc' to halt a core on entering any of Secure EL1 or EL3 or Non-Secure EL1 or EL2. Change-Id: I0c68e247af68dd96616855a9bc1063c277d222e5 Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com> Reviewed-on: http://openocd.zylin.com/4479 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2019-03-01Use enum for target_register_timer_callback()Marc Schink
Change-Id: I268e8c5d783914aa97cbde301448b2c5bc3cb9e6 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4921 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-03-01target: Use proper data types for timer callbackMarc Schink
Change-Id: I5ca6da767f9e96180c43b179b2c682b1b7c98563 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4920 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-02-25aarch64: fix a potential memory leak in aarch64_target_create()Antonio Borneo
If the function aarch64_target_create() exits for an error, the value of pointer aarch64 get lost, causing a memory leak. Move the allocation of aarch64 after the check on the parameters. While there, add a check on the value returned by calloc(). Issue highlighted by clang 7.0.0. Change-Id: Ib9ad27f4acd940da308c01fdbf33cfe51ab0c639 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4924 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2019-02-25mem_ap: fix a potential memory leak in mem_ap_target_create()Antonio Borneo
If the function mem_ap_target_create() exits for an error, the value of pointer mem_ap get lost, causing a memory leak. Move the allocation of mem_ap after the check on the parameters. While there, add a check on the value returned by calloc(). Issue highlighted by clang 7.0.0. Change-Id: Ia2c11b14fde9694f28bf6efe01d278923db0f0d4 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4923 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2019-02-25cortex_a: fix a potential memory leak in cortex_a_target_create()Antonio Borneo
If the function cortex_a_target_create() or the function cortex_r4_target_create() exit for an error, the value of pointer cortex_a get lost, causing a memory leak. Move the allocation of cortex_a after the check on the parameters. While there, add checks on the value returned by calloc(). Issue highlighted by clang 7.0.0. Change-Id: Ic6eeb9c3b39922d016f6d0319eada1a97a6681f0 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4925 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>