aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHsiangkai Wang <Hsiangkai@gmail.com>2012-12-26 17:32:10 +0800
committerFreddie Chopin <freddie.chopin@gmail.com>2013-01-27 14:14:21 +0000
commitf807d6ab3dc86cd258fb459546b52d9b07fe7986 (patch)
tree7d69c40310e1658d766bf6fbe4a8514b4be4f989 /src
parent3eb7d77601b268ac50f9efd152409e1e7a1d83c7 (diff)
libusb: idProduct of USB device may be zero
There is no constraint about idProduct in USB spec. So, pids[i] may be 0 for USB devices. Change-Id: I19d8974f4e7082e8b7e1f2d33c019ac4e61bc1e2 Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com> Reviewed-on: http://openocd.zylin.com/1091 Tested-by: jenkins Reviewed-by: Xiaofan <xiaofanc@gmail.com> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/jtag/drivers/libusb0_common.c2
-rw-r--r--src/jtag/drivers/libusb1_common.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/jtag/drivers/libusb0_common.c b/src/jtag/drivers/libusb0_common.c
index c731ee54..9662803f 100644
--- a/src/jtag/drivers/libusb0_common.c
+++ b/src/jtag/drivers/libusb0_common.c
@@ -28,7 +28,7 @@
static bool jtag_libusb_match(struct jtag_libusb_device *dev,
const uint16_t vids[], const uint16_t pids[])
{
- for (unsigned i = 0; vids[i] && pids[i]; i++) {
+ for (unsigned i = 0; vids[i]; i++) {
if (dev->descriptor.idVendor == vids[i] &&
dev->descriptor.idProduct == pids[i]) {
return true;
diff --git a/src/jtag/drivers/libusb1_common.c b/src/jtag/drivers/libusb1_common.c
index 194f737c..dc6c0a72 100644
--- a/src/jtag/drivers/libusb1_common.c
+++ b/src/jtag/drivers/libusb1_common.c
@@ -33,7 +33,7 @@ static bool jtag_libusb_match(struct jtag_libusb_device *dev,
{
struct libusb_device_descriptor dev_desc;
- for (unsigned i = 0; vids[i] && pids[i]; i++) {
+ for (unsigned i = 0; vids[i]; i++) {
if (libusb_get_device_descriptor(dev, &dev_desc) == 0) {
if (dev_desc.idVendor == vids[i] &&
dev_desc.idProduct == pids[i])