mirror of
https://git.code.sf.net/p/openocd/code
synced 2025-04-23 05:26:35 +00:00
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 <vanekt@fbl.cz> Fixes: commit 8850eb8f2c51 ("swd: get rid of jtag queue to assert/deassert srst") Reviewed-on: https://review.openocd.org/c/openocd/+/8735 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
This commit is contained in:
committed by
Antonio Borneo
parent
71f92c9446
commit
ed4e584104
@ -631,6 +631,13 @@ static int adapter_system_reset(int req_srst)
|
||||
|
||||
/* Maybe change SRST signal state */
|
||||
if (jtag_srst != req_srst) {
|
||||
if (!adapter_driver->reset) {
|
||||
if (req_srst)
|
||||
LOG_ERROR("Adapter driver does not implement SRST handling");
|
||||
|
||||
return ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
retval = adapter_driver->reset(0, req_srst);
|
||||
if (retval != ERROR_OK) {
|
||||
LOG_ERROR("SRST error");
|
||||
|
Reference in New Issue
Block a user