Skip to content

Commit ed4e584

Browse files
tom-vanborneoa
authored andcommitted
jtag/core: fix segfault when adapter driver has no reset method
xlnx-pcie-xvc and linuxspidev adapter drivers does not implement the reset method. Although it is likely both adapters will implement the method in the near future, avoid segfault and return an error instead. Change-Id: If8ddf165dbc563cf6d64b2094968151075778ba7 Signed-off-by: Tomas Vanek <[email protected]> Fixes: commit 8850eb8 ("swd: get rid of jtag queue to assert/deassert srst") Reviewed-on: https://review.openocd.org/c/openocd/+/8735 Reviewed-by: Antonio Borneo <[email protected]> Tested-by: jenkins
1 parent 71f92c9 commit ed4e584

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/jtag/core.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,13 @@ static int adapter_system_reset(int req_srst)
631631

632632
/* Maybe change SRST signal state */
633633
if (jtag_srst != req_srst) {
634+
if (!adapter_driver->reset) {
635+
if (req_srst)
636+
LOG_ERROR("Adapter driver does not implement SRST handling");
637+
638+
return ERROR_NOT_IMPLEMENTED;
639+
}
640+
634641
retval = adapter_driver->reset(0, req_srst);
635642
if (retval != ERROR_OK) {
636643
LOG_ERROR("SRST error");

0 commit comments

Comments
 (0)