From: anpilog Date: Fri, 29 Jan 2016 09:20:20 +0000 (+0800) Subject: cmsis-dap: Fix CMSIS-DAP serial number processing. X-Git-Tag: v0.10.0-rc1~265 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8cf5e04c73bf2d20d8efa7131666ed3a370402aa;p=openocd cmsis-dap: Fix CMSIS-DAP serial number processing. 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 Reviewed-on: http://openocd.zylin.com/3226 Tested-by: jenkins Reviewed-by: Spencer Oliver --- diff --git a/src/jtag/drivers/cmsis_dap_usb.c b/src/jtag/drivers/cmsis_dap_usb.c index ff8b8ffa..889c14ca 100644 --- a/src/jtag/drivers/cmsis_dap_usb.c +++ b/src/jtag/drivers/cmsis_dap_usb.c @@ -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;