aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpencer Oliver <spen@spen-soft.co.uk>2012-01-12 14:15:28 +0000
committerSpencer Oliver <spen@spen-soft.co.uk>2012-01-12 20:46:53 +0000
commitaa29f083a79fe1c2238b66bee84fd2707603e64a (patch)
treeded939a8dbf75e2e0816563f25c0c5dd392dfbd3
parent0cccdde3c726b1ec25fc27b23a6a700260dbf266 (diff)
downloadriscv-openocd-aa29f083a79fe1c2238b66bee84fd2707603e64a.zip
riscv-openocd-aa29f083a79fe1c2238b66bee84fd2707603e64a.tar.gz
riscv-openocd-aa29f083a79fe1c2238b66bee84fd2707603e64a.tar.bz2
stlink: correctly signal stlink_interface_open failure
give the user a error msg on open failure. Change-Id: If4a57bac7f3e1746c2a05c7a96747a38da188041 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/368 Tested-by: jenkins Reviewed-by: Mathias Küster <kesmtp@freenet.de>
-rw-r--r--src/jtag/drivers/stlink_usb.c2
-rw-r--r--src/jtag/stlink/stlink_transport.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c
index aaf55b0..3b262f9 100644
--- a/src/jtag/drivers/stlink_usb.c
+++ b/src/jtag/drivers/stlink_usb.c
@@ -609,7 +609,7 @@ int stlink_usb_open(struct stlink_interface_param_s *param, void **fd)
param->pid);
if (jtag_libusb_open(vids, pids, &h->fd) != ERROR_OK) {
- LOG_DEBUG("stlink_open_usb: open failed");
+ LOG_ERROR("stlink_open_usb: open failed");
return ERROR_FAIL;
}
diff --git a/src/jtag/stlink/stlink_transport.c b/src/jtag/stlink/stlink_transport.c
index c073ffe..14e59ec 100644
--- a/src/jtag/stlink/stlink_transport.c
+++ b/src/jtag/stlink/stlink_transport.c
@@ -142,10 +142,11 @@ static int stlink_transport_init(struct command_context *cmd_ctx)
if (!t) {
LOG_ERROR("stlink_transport_init: no current target");
return ERROR_FAIL;
-
}
- stlink_interface_open();
+ int retval = stlink_interface_open();
+ if (retval != ERROR_OK)
+ return retval;
return stlink_interface_init_target(t);
}