]> git.sur5r.net Git - openocd/commitdiff
stlink: correctly signal stlink_interface_open failure
authorSpencer Oliver <spen@spen-soft.co.uk>
Thu, 12 Jan 2012 14:15:28 +0000 (14:15 +0000)
committerSpencer Oliver <spen@spen-soft.co.uk>
Thu, 12 Jan 2012 20:46:53 +0000 (20:46 +0000)
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>
src/jtag/drivers/stlink_usb.c
src/jtag/stlink/stlink_transport.c

index aaf55b0a531b6010d8133efadfedc5855a90b62a..3b262f9310a475b1eb3e98a20b2abc025ee8ae1c 100644 (file)
@@ -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;
        }
 
index c073ffed65b809ea9750bc6a52fae1e3e06abaf1..14e59ec74666fd9ff3bcb1a8c90aef1bf4558ca5 100644 (file)
@@ -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);
 }