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 8850eb8f2c
("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:
parent
71f92c9446
commit
ed4e584104
|
@ -631,6 +631,13 @@ static int adapter_system_reset(int req_srst)
|
||||||
|
|
||||||
/* Maybe change SRST signal state */
|
/* Maybe change SRST signal state */
|
||||||
if (jtag_srst != req_srst) {
|
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);
|
retval = adapter_driver->reset(0, req_srst);
|
||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
LOG_ERROR("SRST error");
|
LOG_ERROR("SRST error");
|
||||||
|
|
Loading…
Reference in New Issue