]> git.sur5r.net Git - openocd/commitdiff
cmsis-dap: Fix CMSIS-DAP serial number processing.
authoranpilog <anpilog@gmail.com>
Fri, 29 Jan 2016 09:20:20 +0000 (17:20 +0800)
committerAndreas Fritiofson <andreas.fritiofson@gmail.com>
Sat, 13 Feb 2016 23:27:09 +0000 (23:27 +0000)
Check CMSIS-DAP adapter has serialnumber before pass it to wcscmp.
Keep looking for onother adapter if choosed one doesn't have correct
serialnumber.

Change-Id: I7d386a03cb49b9baf22073ae1c6b14269ed3b618
Signed-off-by: Andrii Anpilogov <anpilog@gmail.com>
Reviewed-on: http://openocd.zylin.com/3226
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
src/jtag/drivers/cmsis_dap_usb.c

index ff8b8ffaf767ef6c5bfb2d5afdc10139df1239c6..889c14ca7800b5d43e12fb8cc3882200ef92ff5a 100644 (file)
@@ -214,12 +214,14 @@ static int cmsis_dap_usb_open(void)
                        /* we have found an adapter, so exit further checks */
                        /* check serial number matches if given */
                        if (cmsis_dap_serial != NULL) {
-                               if (wcscmp(cmsis_dap_serial, cur_dev->serial_number) == 0) {
+                               if ((cur_dev->serial_number != NULL) && wcscmp(cmsis_dap_serial, cur_dev->serial_number) == 0) {
                                        serial_found = true;
                                        break;
                                }
                        } else
                                break;
+
+                       found = false;
                }
 
                cur_dev = cur_dev->next;