Check usb_get_port_path() return value
This function can fail. If so, do not ignore the failure.
This commit is contained in:
parent
7bbe5a2b6a
commit
6c1a76d126
|
@ -753,7 +753,9 @@ SR_API const char *sr_dev_inst_connid_get(const struct sr_dev_inst *sdi)
|
|||
if (b != usb->bus || a != usb->address)
|
||||
continue;
|
||||
|
||||
usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
|
||||
if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0)
|
||||
continue;
|
||||
|
||||
((struct sr_dev_inst *)sdi)->connection_id = g_strdup(connection_id);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -194,7 +194,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
|
||||
libusb_close(hdl);
|
||||
|
||||
usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
|
||||
if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0)
|
||||
continue;
|
||||
|
||||
if (!strcmp(product, "ChronoVu LA8"))
|
||||
model = 0;
|
||||
|
|
|
@ -216,7 +216,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
|
||||
libusb_close(hdl);
|
||||
|
||||
usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
|
||||
if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0)
|
||||
continue;
|
||||
|
||||
prof = NULL;
|
||||
for (j = 0; supported_device[j].vid; j++) {
|
||||
|
|
|
@ -568,7 +568,9 @@ SR_PRIV int dslogic_dev_open(struct sr_dev_inst *sdi, struct sr_dev_driver *di)
|
|||
if ((sdi->status == SR_ST_INITIALIZING) ||
|
||||
(sdi->status == SR_ST_INACTIVE)) {
|
||||
/* Check device by its physical USB bus/port address. */
|
||||
usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
|
||||
if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0)
|
||||
continue;
|
||||
|
||||
if (strcmp(sdi->connection_id, connection_id))
|
||||
/* This is not the one. */
|
||||
continue;
|
||||
|
|
|
@ -265,7 +265,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
|
||||
libusb_close(hdl);
|
||||
|
||||
usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
|
||||
if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0)
|
||||
continue;
|
||||
|
||||
prof = NULL;
|
||||
for (j = 0; supported_fx2[j].vid; j++) {
|
||||
|
|
|
@ -174,7 +174,9 @@ SR_PRIV int fx2lafw_dev_open(struct sr_dev_inst *sdi, struct sr_dev_driver *di)
|
|||
/*
|
||||
* Check device by its physical USB bus/port address.
|
||||
*/
|
||||
usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
|
||||
if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0)
|
||||
continue;
|
||||
|
||||
if (strcmp(sdi->connection_id, connection_id))
|
||||
/* This is not the one. */
|
||||
continue;
|
||||
|
|
|
@ -180,7 +180,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
des.idProduct != H4032L_USB_PRODUCT)
|
||||
continue;
|
||||
|
||||
usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
|
||||
if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0)
|
||||
continue;
|
||||
|
||||
sdi = g_malloc0(sizeof(struct sr_dev_inst));
|
||||
sdi->driver = &hantek_4032l_driver_info;
|
||||
|
|
|
@ -217,7 +217,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
|
||||
libusb_get_device_descriptor(devlist[i], &des);
|
||||
|
||||
usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
|
||||
if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0)
|
||||
continue;
|
||||
|
||||
prof = NULL;
|
||||
for (j = 0; dev_profiles[j].orig_vid; j++) {
|
||||
|
|
|
@ -46,7 +46,9 @@ SR_PRIV int hantek_6xxx_open(struct sr_dev_inst *sdi)
|
|||
/*
|
||||
* Check device by its physical USB bus/port address.
|
||||
*/
|
||||
usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
|
||||
if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0)
|
||||
continue;
|
||||
|
||||
if (strcmp(sdi->connection_id, connection_id))
|
||||
/* This is not the one. */
|
||||
continue;
|
||||
|
|
|
@ -315,7 +315,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
|
||||
libusb_get_device_descriptor(devlist[i], &des);
|
||||
|
||||
usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
|
||||
if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0)
|
||||
continue;
|
||||
|
||||
prof = NULL;
|
||||
for (j = 0; dev_profiles[j].orig_vid; j++) {
|
||||
|
|
|
@ -130,7 +130,9 @@ SR_PRIV int dso_open(struct sr_dev_inst *sdi)
|
|||
/*
|
||||
* Check device by its physical USB bus/port address.
|
||||
*/
|
||||
usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
|
||||
if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0)
|
||||
continue;
|
||||
|
||||
if (strcmp(sdi->connection_id, connection_id))
|
||||
/* This is not the one. */
|
||||
continue;
|
||||
|
|
|
@ -134,7 +134,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
if (des.idVendor != LOGICSTUDIO16_VID)
|
||||
continue;
|
||||
|
||||
usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
|
||||
if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0)
|
||||
continue;
|
||||
|
||||
usb = NULL;
|
||||
|
||||
|
@ -210,7 +211,8 @@ static int open_device(struct sr_dev_inst *sdi)
|
|||
des.idProduct != LOGICSTUDIO16_PID_HAVE_FIRMWARE)
|
||||
continue;
|
||||
|
||||
usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
|
||||
if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Check if this device is the same one that we associated
|
||||
|
|
|
@ -240,7 +240,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
if (des.idVendor != 0x21a9 || des.idProduct != 0x1006)
|
||||
continue;
|
||||
|
||||
usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
|
||||
if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0)
|
||||
continue;
|
||||
|
||||
sdi = g_malloc0(sizeof(struct sr_dev_inst));
|
||||
sdi->status = SR_ST_INITIALIZING;
|
||||
|
|
|
@ -188,7 +188,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
|
||||
libusb_get_device_descriptor(devlist[i], &des);
|
||||
|
||||
usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
|
||||
if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0)
|
||||
continue;
|
||||
|
||||
if (des.idVendor != LOGIC16_VID || des.idProduct != LOGIC16_PID)
|
||||
continue;
|
||||
|
@ -266,7 +267,9 @@ static int logic16_dev_open(struct sr_dev_inst *sdi)
|
|||
/*
|
||||
* Check device by its physical USB bus/port address.
|
||||
*/
|
||||
usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
|
||||
if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0)
|
||||
continue;
|
||||
|
||||
if (strcmp(sdi->connection_id, connection_id))
|
||||
/* This is not the one. */
|
||||
continue;
|
||||
|
|
|
@ -109,7 +109,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
if (strncmp(manufacturer, "testo", 5))
|
||||
continue;
|
||||
|
||||
usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
|
||||
if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0)
|
||||
continue;
|
||||
|
||||
/* Hardcode the 435 for now. */
|
||||
if (strcmp(product, "testo 435/635/735"))
|
||||
|
|
|
@ -69,7 +69,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
if (des.idVendor != VICTOR_VID || des.idProduct != VICTOR_PID)
|
||||
continue;
|
||||
|
||||
usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
|
||||
if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0)
|
||||
continue;
|
||||
|
||||
sdi = g_malloc0(sizeof(struct sr_dev_inst));
|
||||
sdi->status = SR_ST_INACTIVE;
|
||||
|
|
|
@ -196,7 +196,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
|
||||
libusb_close(hdl);
|
||||
|
||||
usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
|
||||
if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0)
|
||||
continue;
|
||||
|
||||
prof = NULL;
|
||||
for (j = 0; j < zeroplus_models[j].vid; j++) {
|
||||
|
|
Loading…
Reference in New Issue